Open johnpaulashenfelter opened 8 years ago
Sadly, #10 only works for legacy Rails applications (v5 and prior).
For anyone wondering, my current workaround for an SPA is to define a layout helper and use this in all views:
app/helpers/layout_helper.rb
app/views/users/show.json.jb
I've tried to update #10 to get to work with at least the current Rails version (7.2), but wasn't able to yet.
I may be doing something wrong, but I'm trying to add a layout so I can standardize some metadata in the JSON output.
I've got an
layouts\api.jb
file and I've requested that layout in the controller generating the json output.I've tried ERB layout template, using
content_for
, assigning the template output to variables (including instance vars) and usingyield
or ERB rendering. All lead to similar issues.Am I totally missing something simple @amatsuda ?