Replies: 3 comments 1 reply
-
Hi Noah! Would you share an example of the controller action, and how you would expect it to work? Normally, if you use |
Beta Was this translation helpful? Give feedback.
-
@ElMassimo - sorry for the slow reply and thanks for the great gem! Its not about a conflict. It is that with jbuilder, you can have an action like:
If it was an HTML request, |
Beta Was this translation helpful? Give feedback.
-
Fair enough. I appreciate the sample code!
…On Mon, May 15, 2023, 11:46 AM Máximo Mussini ***@***.***> wrote:
This gem does not attempt to infer a serializer for a specific object, as
from a maintenance perspective, using serializers implicitly makes it
really hard to detect dead code in the long run.
------------------------------
If you would like to add this behavior to your app, you could define a default
render method in ApplicationController:
def default_render
if @JSON
render json: ***@***.******@***.***)
else
super
endend
Notice that serializers don't lend themselves to the "implicit render"
pattern, as you would need to somehow specify which object should be passed
to the serializer—unlike views which have access to all instance variables.
—
Reply to this email directly, view it on GitHub
<#14 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABR24VJYZUECB6734KAK43XGJTVXANCNFSM6AAAAAAXXJDJDI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi all,
I have been trying to figure out how to turn off jbuilder as the default responder for JSON and use OJ. Anyone know the incantation?
Beta Was this translation helpful? Give feedback.
All reactions