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

Fix options passing in Json and Attributes adapters #1185

Merged
merged 2 commits into from
Sep 21, 2015

Conversation

beauby
Copy link
Contributor

@beauby beauby commented Sep 21, 2015

As mentioned in #1184, there are issues with the way options are passed between adapters. This PR adds a failing test and provides fixes.

@NullVoxPopuli
Copy link
Contributor

👍


def test_include_option
serializer = ArraySerializer.new([@first_post, @second_post])
adapter = ActiveModel::Serializer::Adapter::Json.new(serializer, include: '')
Copy link
Member

Choose a reason for hiding this comment

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

what did it do before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It disregarded the include option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It did so every time for the Json adapter, and only for collections for the Attribute adapter.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, but when it failed, how was the output different? (lazy me)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It did include stuff, although it was explicitly told not to.

NullVoxPopuli added a commit that referenced this pull request Sep 21, 2015
Fix options passing in Json and Attributes adapters
@NullVoxPopuli NullVoxPopuli merged commit 94cee19 into rails-api:master Sep 21, 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.

3 participants