Skip to content

Instantly share code, notes, and snippets.

@phoet
Created April 6, 2011 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phoet/905286 to your computer and use it in GitHub Desktop.
Save phoet/905286 to your computer and use it in GitHub Desktop.
initializer for helping to find partials in large applications
if development?
module ActionView
class Base
alias_method :rails_render, :render
# add debugging comments for partials to the rendered html
def render(options = {}, local_assigns = {}, &block)
output = rails_render(options, local_assigns, &block)
if options.respond_to?(:keys) && options[:partial] && (response.content_type.nil? || response.content_type =~ /html/)
debug_output = "rendering partial '#{options[:partial]}'"
output = "<!-- START #{debug_output} -->\n#{output}\n<!-- END #{debug_output} -->"
end
output
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment