-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix options passing in Json and Attributes adapters #1185
Conversation
👍 |
|
||
def test_include_option | ||
serializer = ArraySerializer.new([@first_post, @second_post]) | ||
adapter = ActiveModel::Serializer::Adapter::Json.new(serializer, include: '') |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
Fix options passing in Json and Attributes adapters
As mentioned in #1184, there are issues with the way options are passed between adapters. This PR adds a failing test and provides fixes.