-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
.to_json
ignores .as_json
but render json:
doesn't
#540
Comments
I feel your pain. I have struggled for a long time to mimic the rails and JSON behavior when they are combined. It is very finicky. I suspect you will see similar behavior with rails and the JSON gem. I believe Something you could try would be to put the |
Thanks for the quick response! It helps to know I'm not misunderstanding the docs and this is actually hard! =] I'll do some more testing soon and report back!
I'm not sure what you mean by what does it look like. Like, what code paths it actually executes? I'm not sure how to check that besides |
There are some trace options that can be used. Oj has a trace option as well. I think you will find that the JSON gem sets up the |
Any thing else I can help you with? |
Sorry for the lack of comm, I haven't poked at this again and don't know when I'll have time. Closing the issue. Will reopen if I have any trouble. Thanks for the help! |
I just ran into this, I'm fairly certain it's because Line 1343 in 0032fbb
I might try and solve this in our app by overwriting what |
I opened a new issue to discuss this specific problem with render json I discovered: #913 |
I'm struggling to understand this behavior, not sure if I'm approaching things with the wrong expectation here or if I'm misunderstanding the modes and settings, but I can't find a way to make
.to_json
andrender json:
to have consistent behavior when overridingas_json
.In my
application.rb
:A
Module
with overriddenas_json
:render json: Something
I get{"tag":"Submitted"}
Something.to_json
I get"Something"
An example app demonstrating the behavior: https://repl.it/repls/ComfortableWhoppingWorkspaces
The text was updated successfully, but these errors were encountered: