Render a JBuilder view in html view
问题 I've created a json view with JBuilder. But I want to preload this into a data object, so Backbone has access to the data early on without fetching for it. How can I render the list.json.jbuilder view into my list.html.erb view? Normally without jbuilder, I'd do something like this: <div data-list="<%= @contents.to_json %>"></div> 回答1: render , when called from within a view, returns a string rendering of the passed template or partial; you can embed that string into your view as you like.