Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add link to info on setting polymorphic serializers #1906

Merged
merged 1 commit into from
Sep 7, 2016
Merged

Add link to info on setting polymorphic serializers #1906

merged 1 commit into from
Sep 7, 2016

Conversation

Rio517
Copy link
Contributor

@Rio517 Rio517 commented Sep 2, 2016

Purpose

Add a reference to show how to set sterilizers on polymorphic relationships.

Changes

Add a single sentence with a link that points to a header further down the page.

Additional helpful information

While this same document provides details on how to override the serializer_for, not all users will realize this could be used to set the sterilizers for polymorphic relationships. This change just adds a link to that documentation and makes that point obvious.

@mention-bot
Copy link

@Rio517, thanks for your PR! By analyzing the annotation information on this pull request, we identified @marcgarreau, @bf4 and @yogeshjain999 to be potential reviewers

@@ -140,7 +140,7 @@ class PictureSerializer < ActiveModel::Serializer
end
```

For more context, see the [tests](../../test/adapter/polymorphic_test.rb) for each adapter.
You can specify the serializers by [overriding serializer_for](https://github.com/rails-api/active_model_serializers/blob/master/docs/general/serializers.md#overriding-association-serializer-lookup). For more context about polymorphic relationships, see the [tests](../../test/adapter/polymorphic_test.rb) for each adapter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rio517 awesome, let's use a relative link (serializers.md#overriding-association-serializer-lookup)

@NullVoxPopuli
Copy link
Contributor

@Rio517 do you want to finish this up? :-)

While this same document provides details on how to override the
serializer_for, not all users will realize this could be used to set the
sterilizers for polymorphic relationships.  This change just adds a link
to that documentation and makes that point obvious.
@NullVoxPopuli
Copy link
Contributor

LGTM

@NullVoxPopuli NullVoxPopuli merged commit 1899437 into rails-api:master Sep 7, 2016
richmolj pushed a commit to richmolj/active_model_serializers that referenced this pull request Sep 16, 2016
While this same document provides details on how to override the
serializer_for, not all users will realize this could be used to set the
sterilizers for polymorphic relationships.  This change just adds a link
to that documentation and makes that point obvious.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants