提交 1656f58f 编写于 作者: Ł Łukasz Strzałkowski

Improve AV::Rendering docs

上级 71833253
...@@ -41,6 +41,9 @@ def render_to_string(*args, &block) ...@@ -41,6 +41,9 @@ def render_to_string(*args, &block)
def render_to_body(options = {}) def render_to_body(options = {})
end end
# Normalize arguments, options and then delegates render_to_body and
# sticks the result in self.response_body.
# :api: public
def render(*args, &block) def render(*args, &block)
end end
......
...@@ -71,24 +71,28 @@ def view_context ...@@ -71,24 +71,28 @@ def view_context
end end
# Returns an object that is able to render templates. # Returns an object that is able to render templates.
# :api: private
def view_renderer def view_renderer
@_view_renderer ||= ActionView::Renderer.new(lookup_context) @_view_renderer ||= ActionView::Renderer.new(lookup_context)
end end
# Normalize arguments, options and then delegates render_to_body and # Render template to response_body
# sticks the result in self.response_body. # :api: public
def render(*args, &block) def render(*args, &block)
super super
options = _normalize_render(*args, &block) options = _normalize_render(*args, &block)
self.response_body = render_to_body(options) self.response_body = render_to_body(options)
end end
# Raw rendering of a template to a string.
# :api: public
def render_to_string(*args, &block) def render_to_string(*args, &block)
options = _normalize_render(*args, &block) options = _normalize_render(*args, &block)
render_to_body(options) render_to_body(options)
end end
# Raw rendering of a template. # Raw rendering of a template.
# :api: public
def render_to_body(options = {}) def render_to_body(options = {})
_process_options(options) _process_options(options)
_render_template(options) _render_template(options)
...@@ -117,6 +121,7 @@ def _normalize_render(*args, &block) ...@@ -117,6 +121,7 @@ def _normalize_render(*args, &block)
# Normalize args by converting render "foo" to render :action => "foo" and # Normalize args by converting render "foo" to render :action => "foo" and
# render "foo/bar" to render :file => "foo/bar". # render "foo/bar" to render :file => "foo/bar".
# :api: private
def _normalize_args(action=nil, options={}) def _normalize_args(action=nil, options={})
options = super(action, options) options = super(action, options)
case action case action
...@@ -135,6 +140,7 @@ def _normalize_args(action=nil, options={}) ...@@ -135,6 +140,7 @@ def _normalize_args(action=nil, options={})
end end
# Normalize options. # Normalize options.
# :api: private
def _normalize_options(options) def _normalize_options(options)
options = super(options) options = super(options)
if options[:partial] == true if options[:partial] == true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册