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

:serializer option now can take a symbol as a method to call. #865

Open
wants to merge 1 commit into
base: 0-8-stable
Choose a base branch
from

Conversation

mehlah
Copy link

@mehlah mehlah commented Mar 30, 2015

Fix suggestion for #825

This is handy for specifying a custom serializer class based on
conditionals.

This is handy for specifying a custom serializer class based on
conditionals.
Fix suggestion for rails-api#825
@webattitude
Copy link

👍

elsif serializer.is_a?(Symbol)
source_serializer.send(serializer)
else
serializer
Copy link
Member

Choose a reason for hiding this comment

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

Interesting point. I'm not really sure what I think about it.

This code could be

case serializer
when String then serializer.constantize
when Symbol then source_serializer.send(serializer)
else serializer
end

Copy link
Contributor

Choose a reason for hiding this comment

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

this looks a bit cleaner (the case/when)

@remear
Copy link
Member

remear commented Mar 15, 2016

@rails-api/ams Do we want to continue with this?

@mehlah
Copy link
Author

mehlah commented Mar 16, 2016

Pls let me know if you want me to update the code and rebase it /cc @remear

@beauby
Copy link
Contributor

beauby commented Apr 18, 2016

I have very little knowledge of 0.8. cc @joaomdmoura ?

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.

None yet

7 participants