Skip to content

Commit

Permalink
Improve AV::Rendering docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszx0 committed Aug 25, 2013
1 parent 7183325 commit 1656f58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions actionpack/lib/abstract_controller/rendering.rb
Expand Up @@ -41,6 +41,9 @@ def render_to_string(*args, &block)
def render_to_body(options = {})
end

# Normalize arguments, options and then delegates render_to_body and
# sticks the result in self.response_body.
# :api: public
def render(*args, &block)
end

Expand Down
10 changes: 8 additions & 2 deletions actionview/lib/action_view/rendering.rb
Expand Up @@ -71,24 +71,28 @@ def view_context
end

# Returns an object that is able to render templates.
# :api: private
def view_renderer
@_view_renderer ||= ActionView::Renderer.new(lookup_context)
end

# Normalize arguments, options and then delegates render_to_body and
# sticks the result in self.response_body.
# Render template to response_body
# :api: public
def render(*args, &block)
super
options = _normalize_render(*args, &block)
self.response_body = render_to_body(options)
end

# Raw rendering of a template to a string.
# :api: public
def render_to_string(*args, &block)
options = _normalize_render(*args, &block)
render_to_body(options)
end

# Raw rendering of a template.
# :api: public
def render_to_body(options = {})
_process_options(options)
_render_template(options)
Expand Down Expand Up @@ -117,6 +121,7 @@ def _normalize_render(*args, &block)

# Normalize args by converting render "foo" to render :action => "foo" and
# render "foo/bar" to render :file => "foo/bar".
# :api: private
def _normalize_args(action=nil, options={})
options = super(action, options)
case action
Expand All @@ -135,6 +140,7 @@ def _normalize_args(action=nil, options={})
end

# Normalize options.
# :api: private
def _normalize_options(options)
options = super(options)
if options[:partial] == true
Expand Down

0 comments on commit 1656f58

Please sign in to comment.