Skip to content

Instantly share code, notes, and snippets.

@excid3
Created August 28, 2013 22:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save excid3/6372212 to your computer and use it in GitHub Desktop.
Save excid3/6372212 to your computer and use it in GitHub Desktop.
Override ActionView::Renderer to inject view template/partial names into the HTML.
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
@excid3
Copy link
Author

excid3 commented Aug 28, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment