-
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
refactor to make way for easy feature adding #1111
refactor to make way for easy feature adding #1111
Conversation
serializer.map { |s| FlattenJson.new(s).serializable_hash(options) } | ||
end | ||
|
||
# TODO: what is a virtual value? |
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's an internal thing that uses that value instead of a serialized attribute. e.g. there's no serializer for Ruby arrays, so it would just use the array as the virtual value. see #962
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.
ah ok, cool.
I'll add a comment about that to help future contributors.
💯 Some thoughts:
thoughts? |
I'll see what I can do to mimic json_api's naming and flow. |
opts = association.options | ||
|
||
if serializer.respond_to?(:each) | ||
add_relationships(association.key, serializer, opts) |
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.
I know the terminology comes from the json_api
adapter, but I think add_to_many_relationship
and add_to_one_relationship
are more intuitive name than the confusingly similar add_relationship
/add_relationships
.
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.
I agree, should json_api's naming change as well? - I am not as familiar with json_api though
f05cf96
to
4f2ad3e
Compare
This is really nice. I'm closing it because it was already ported on #1114 |
Big methods can be hard to work with.
Since there are upcoming changes to the json adapter, I figured I'd make things a little easier to digest (especially re: recursion).