module RailsCom::TemplateRenderer

Public Instance Methods

render_template(template, layout_name = nil, locals = nil) click to toggle source

record where the view rendered from, main project or which engine used by view helper methods: js_load, css_load, js_ready

Calls superclass method
# File lib/rails_com/action_view/template_renderer.rb, line 7
def render_template(template, layout_name = nil, locals = nil)
  path = template.identifier

  result = path.match(/(?<=\/)[a-zA-Z0-9_-]+(?=\/app\/views)/)
  result = result.to_s.split('-').first.to_s + '/engine'

  engine = result.classify.safe_constantize

  @view.instance_variable_set(:@_rendered_from, engine.root) if engine

  super
end