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

Send options to to_json #34

Closed
prcongithub opened this issue Feb 9, 2015 · 5 comments
Closed

Send options to to_json #34

prcongithub opened this issue Feb 9, 2015 · 5 comments

Comments

@prcongithub
Copy link

Why can't we send the options to to_json method?
https://github.com/guyboertje/jrjackson/blob/master/lib/jrjackson/jrjackson.rb#L44

@guyboertje
Copy link
Owner

@prcongithub - So I can understand your JrJackson usage better, upon what objects is to_json being called?

I take it that you have read:
wiki page: https://github.com/guyboertje/jrjackson/wiki/JrJackson-does-not-support-nested-non-JSON-datatypes-%28apart-from-Symbol%29
issue: #25

@prcongithub
Copy link
Author

May be I am missing something here, So JrJackson doesn't support ActiveRecord objects. But if you still call dump method with AR objects, JrJackson will fallback to .to_json right? If so, then can't we pass options to the to_json method?

@guyboertje
Copy link
Owner

ActiveRecord object do not have a to_json method. What other objects is to_json being called on?

@guyboertje
Copy link
Owner

@prcongithub OK - I misled you. It does, but it only (eventually) delegates to the Json gem, and then it does not pass the options that far.

Why use JrJackson at all if AR ends up calling the Json gem?

JrJackson supports the to_json method as a last resort if the custom object author implemented to_json.

I really regret including the fallback to to_json, for the above reason.

@guyboertje
Copy link
Owner

Closing - no more feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants