I am trying to have a json response in which some value is html rendered by a partial
#projects_Controller.rb
def index
respond_to do |f|
f.json
en
Got it: All one needs is this line in the .json.erb file <% self.formats = ["html"] %>
So the full index.json.erb
<% self.formats = ["html"] %>
disclaimer = {
"html":"<%= raw escape_javascript(render :partial => 'projects/disclaimer',
:content_type => 'text/html'),
:locals => {:localVariable => @localVariable}
%>"
}