Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save idoru/517787 to your computer and use it in GitHub Desktop.
Save idoru/517787 to your computer and use it in GitHub Desktop.
if Rails.env.development? || Rails.env.cucumber?
module ActionView
module Partials
def render_partial_with_annotations(options = {})
begin
if partial_path = options[:partial]
allocated_objects_before = ObjectSpace.allocated_objects
%{\n<!-- START PARTIAL: "#{partial_path}" -->\n#{render_partial_without_annotations(options)}\n<!-- #{ObjectSpace.allocated_objects - allocated_objects_before} objects allocated END PARTIAL: "#{partial_path}" -->\n}
else
render_partial_without_annotations(options)
end
rescue
render_partial_without_annotations(options)
end
end
alias_method_chain :render_partial, :annotations
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment