rabl icon indicating copy to clipboard operation
rabl copied to clipboard

Rails 4 and RABL

Open glaucocustodio opened this issue 11 years ago • 8 comments

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.

glaucocustodio avatar Jul 18 '13 14:07 glaucocustodio

Thanks for the report, I will try to play around with RABL and Rails 4 soon and see if anything needs to be tweaked.

nesquena avatar Jul 18 '13 18:07 nesquena

I consider to use Rails 4 and RABL in production. Is there any news about this issue?

scaryguy avatar Aug 13 '13 10:08 scaryguy

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.

nesquena avatar Aug 13 '13 18:08 nesquena

Can you try RABL 0.9.0.pre (gem install rabl --pre) and verify that the rails 4 issues have been resolved?

nesquena avatar Sep 03 '13 03:09 nesquena

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.

brentmulligan avatar Oct 11 '13 22:10 brentmulligan

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.

nesquena avatar Oct 13 '13 21:10 nesquena

Maybe you can close this as I've not had any trouble with 0.9.4.pre1.

chewi avatar May 01 '14 15:05 chewi

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.

raykin avatar Aug 21 '14 06:08 raykin