Search code examples
ruby-on-railsrabljbuilder

Rails use RABL and jbuilder in the same app?


I have a Rails app that is currently using RABL for json. I have code I can copy that's written in jbuilder. Eventually, I want to confer the app to all jbuilder.

But, in the mean time, can I have both RABL and jbuilder in the same app?

For instance have both of these type files:

locations.json.jbuilder
show.json.rabl

Thanks for the info!


Solution

  • Yes, I've done it, no problem. RABL and JBUILDER can coexist in the same rails project.

    As long as you don't use a RABL and JBUILDER view with the same name. My recollection is that the jbuilder view took precedence but that might have been a quirk of my application.

    Personally I prefer the flexibility of RABL... it gives you both json and xml for no extra cost.