Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-template-inheritance.rb

Instance Method Summary collapse

Instance Method Details

#localsObject



35
36
37
# File 'lib/rails-template-inheritance.rb', line 35

def locals
  @locals ||= {request: request}
end

#render_for_file(template_path, status = nil, layout = nil, locals = {}) ⇒ Object

:nodoc:



28
29
30
31
32
33
# File 'lib/rails-template-inheritance.rb', line 28

def render_for_file(template_path, status = nil, layout = nil, locals = {}) #:nodoc:
  Rango::Template.template_paths = @template.view_paths
  path = template_path.respond_to?(:path_without_format_and_extension) ? template_path.path_without_format_and_extension : template_path
  logger.info("Rendering #{path}" + (status ? " (#{status})" : '')) if logger
  render_for_text Rango::RenderMixin.render(template_path.template_path, self.scope, self.locals), status
end

#scopeObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/rails-template-inheritance.rb', line 39

def scope
  self.dup.tap do |scope|
    scope.extend(self.class.master_helper_module)
    ActionView::Helpers.constants.grep(/Helper$/).each do |name|
      helper = ActionView::Helpers.const_get(name)
      scope.extend(helper)
      scope.instance_variable_set(:@controller, self)
    end
  end
end