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

Extract attributes filtering from serializer into adapter. #1232

Merged
merged 1 commit into from
Oct 5, 2015

Conversation

beauby
Copy link
Contributor

@beauby beauby commented Oct 5, 2015

Filtering attributes is an adapter concern. Plus, this PR simplifies the Fieldset utility class by constraining it to the JSON API use case.

@beauby beauby force-pushed the move-root-to-adapter branch from c69fa49 to 19c2558 Compare October 5, 2015 04:26
@beauby beauby force-pushed the move-root-to-adapter branch 3 times, most recently from 8179beb to 387d548 Compare October 5, 2015 05:47
@beauby beauby force-pushed the move-root-to-adapter branch from 387d548 to 658810e Compare October 5, 2015 06:21
@@ -57,7 +57,10 @@ def include_meta(json)

def resource_object_for(options)
cache_check(serializer) do
serializer.attributes(options)
attributes = serializer.attributes
attributes.slice!(*options[:fields]) if options[:fields]
Copy link
Contributor

Choose a reason for hiding this comment

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

why did this need to be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually the main change of this PR: instead of being handled at serializer level, this is now handled at adapter level which allows for different format per adapter.

Copy link
Contributor

Choose a reason for hiding this comment

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

neato

@NullVoxPopuli
Copy link
Contributor

lgtm 👍

NullVoxPopuli added a commit that referenced this pull request Oct 5, 2015
Extract attributes filtering from serializer into adapter.
@NullVoxPopuli NullVoxPopuli merged commit 3fe343f into rails-api:master Oct 5, 2015
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.

2 participants