rabl
rabl copied to clipboard
Rails 4 and RABL
Hi guys, I am using rabl in a Rails 4 project and the only way I found to get template render (with .json.rabl file) working was adding layout false, :only => :action
for action that I want to return formated json. if I remove this line I get the error There was an error parsing the JSON document. The document may not be well-formed.
In this Railscasts http://railscasts.com/episodes/322-rabl Ryan does not set layout false. What is up?
Thank you guys.
Thanks for the report, I will try to play around with RABL and Rails 4 soon and see if anything needs to be tweaked.
I consider to use Rails 4 and RABL in production. Is there any news about this issue?
Don't have a Rails 4 app in production yet so I've been slow to fix this. I will try to get around to this soon, in the meantime patches or advice welcome.
Can you try RABL 0.9.0.pre (gem install rabl --pre) and verify that the rails 4 issues have been resolved?
Using 0.8.6 and then 0.9.0.pre4 with Rails 4 my Rabl templates were being rendered within a plain text HTML application template. I was able to resolve this issue by adding 'layout false' at the top of the controller.
Interesting, thanks for letting me know. I'm hoping someone that is currently using Rails 4 would investigate this and let me know if there's an easy fix. At the moment I'm working mostly with Sinatra but I'd love to pull in better Rails 4 support.
Maybe you can close this as I've not had any trouble with 0.9.4.pre1.
On my app with rails4.1.4 and rabl 0.11.0, I found when I use application.html.slim in app/views/layouts, the response didn't include layout, when I use application.slim, the response include layout. I take some more research on runtime trace, these two different situations have different runtime traces on this file https://github.com/rails/rails/blob/master/actionview/lib/action_view/layouts.rb.