Module: RailsTemplateDebugger::ActionViewTemplateRenderWithComment

Defined in:
lib/rails_template_debugger.rb

Instance Method Summary collapse

Instance Method Details

#render(view, locals, buffer = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rails_template_debugger.rb', line 9

def render(view, locals, buffer = nil, &block)
  return super unless html_template?

  path = identifier.remove(Rails.root.to_s + "/")
  # path_short = path.match(/app\/views\/(.*)/)&.captures&.first

  [
    "<!-- TEMPLATE START #{path} -->",
    "<meta name='rails_template_debugger' path='#{path}' />",
    super,
    "<!-- TEMPLATE END #{path} -->"
  ].join("\n").html_safe
end