Class: RTeX::Framework::Rails::TemplateHandler

Inherits:
ActionView::TemplateHandlers::ERB
  • Object
show all
Defined in:
lib/rtex/framework/rails.rb

Instance Method Summary collapse

Instance Method Details

#compile(template) ⇒ Object

Due to significant changes in ActionView over the lifespan of Rails, tagging compiled templates to set a thread local variable flag seems to be the least brittle approach.



22
23
24
25
# File 'lib/rtex/framework/rails.rb', line 22

def compile(template)
  # Insert assignment, but not before the #coding: line, if present
  super.sub(/^(?!#)/m, "Thread.current[:_rendering_rtex] = true;\n")
end