Module: ActionView::Rendering

Extended by:
ActiveSupport::Concern
Includes:
ViewPaths
Included in:
Layouts
Defined in:
lib/action_view/rendering.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from ViewPaths

#_prefixes, #append_view_path, #details_for_lookup, #lookup_context, #prepend_view_path

Instance Method Details

#processObject

Overwrite process to setup I18n proxy.



28
29
30
31
32
33
# File 'lib/action_view/rendering.rb', line 28

def process(*) #:nodoc:
  old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context)
  super
ensure
  I18n.config = old_config
end

#render_to_body(options = {}) ⇒ Object



81
82
83
84
# File 'lib/action_view/rendering.rb', line 81

def render_to_body(options = {})
  _process_options(options)
  _render_template(options)
end

#rendered_formatObject



86
87
88
# File 'lib/action_view/rendering.rb', line 86

def rendered_format
  Template::Types[lookup_context.rendered_format]
end

#view_contextObject

An instance of a view class. The default view class is ActionView::Base.

The view class must have the following methods: View.new[lookup_context, assigns, controller]

Create a new ActionView instance for a controller and we can also pass the arguments.

View#render(option)

Returns String with the rendered template

Override this method in a module to change the default behavior.



71
72
73
# File 'lib/action_view/rendering.rb', line 71

def view_context
  view_context_class.new(view_renderer, view_assigns, self)
end

#view_context_classObject



58
59
60
# File 'lib/action_view/rendering.rb', line 58

def view_context_class
  @_view_context_class ||= self.class.view_context_class
end

#view_rendererObject

Returns an object that is able to render templates. :api: private



77
78
79
# File 'lib/action_view/rendering.rb', line 77

def view_renderer
  @_view_renderer ||= ActionView::Renderer.new(lookup_context)
end