public
Created

Override ActionView::Renderer to inject view template/partial names into the HTML.

  • Download Gist
renderer.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module ActionView
class Renderer
def render(context, options)
Rails.logger.info options.inspect
 
result = if options.key?(:partial)
render_partial(context, options)
else
render_template(context, options)
end
 
result + "#{options}"
end
end
end

You'll probably need to add some logic here to ignore things like the layout, but this will output the options hash at the end of each template that is rendered.

It also prints out the hash in the console so you can see what it's like.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.