Skip to content

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

Open
mehlah wants to merge 1 commit intorails-api:0-8-stablefrom
mehlah:fix-issue-825
Open

:serializer option now can take a symbol as a method to call.#865
mehlah wants to merge 1 commit intorails-api:0-8-stablefrom
mehlah:fix-issue-825

Conversation

@mehlah
Copy link
Copy Markdown

@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
Copy Markdown

👍

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

remear commented Mar 15, 2016

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

@mehlah
Copy link
Copy Markdown
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
Copy Markdown
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.

7 participants