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.



30
31
32
33
34
35
# File 'lib/action_view/rendering.rb', line 30

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



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

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

#rendered_formatObject



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

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.



73
74
75
# File 'lib/action_view/rendering.rb', line 73

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

#view_context_classObject



60
61
62
# File 'lib/action_view/rendering.rb', line 60

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

#view_rendererObject

Returns an object that is able to render templates.



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

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