Created
April 6, 2011 07:42
-
-
Save phoet/905286 to your computer and use it in GitHub Desktop.
initializer for helping to find partials in large applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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