Rails: Using JBuilder views outside of the view context

Viewed 3948

I am currently switching ActiveModelSeralizer to JBuilder for rendering jsons. I was wondering, with ActiveModelSeralizer I can do something like:

text_content = UserSeralizer.new(user, :root => false)

And receieve the json string in the variable called text_content. Now that I am switching away from ActiveModelSeralizer, is there anyway to do the above with JBuilder?

I have a view partial inside of app/view/api/v1/users/_user.json.jbuilder Is there anyway to render that partial into a variable?

Thanks

5 Answers
Related