diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-10 12:34:31 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-10 12:43:26 +0200 |
commit | 940b57789fb9166658974c591e68d22ecab29f34 (patch) | |
tree | ffaf3b57cc89663f5e48a7fc5567dcb510fa931e /actionpack/lib/action_view/render/rendering.rb | |
parent | b88f4ca93bcaef9a6bfd21d95acc8f432a3c8e5c (diff) | |
download | rails-940b57789fb9166658974c591e68d22ecab29f34.tar.gz rails-940b57789fb9166658974c591e68d22ecab29f34.tar.bz2 rails-940b57789fb9166658974c591e68d22ecab29f34.zip |
Add support to render :once.
This will be used internally by sprockets to ensure requires are executed just once.
Diffstat (limited to 'actionpack/lib/action_view/render/rendering.rb')
-rw-r--r-- | actionpack/lib/action_view/render/rendering.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb index adbb6bc626..0cd5d9d437 100644 --- a/actionpack/lib/action_view/render/rendering.rb +++ b/actionpack/lib/action_view/render/rendering.rb @@ -10,6 +10,7 @@ module ActionView # * <tt>:file</tt> - Renders an explicit template file (this used to be the old default), add :locals to pass in those. # * <tt>:inline</tt> - Renders an inline template similar to how it's done in the controller. # * <tt>:text</tt> - Renders the text passed in out. + # * <tt>:once</tt> - Receives :template paths and ensures they are rendered just once. # # If no options hash is passed or :update specified, the default is to render a partial and use the second parameter # as the locals hash. @@ -20,6 +21,8 @@ module ActionView _render_partial(options.merge(:partial => options[:layout]), &block) elsif options.key?(:partial) _render_partial(options) + elsif options.key?(:once) + _render_once(options) else _render_template(options) end @@ -88,6 +91,10 @@ module ActionView end end + def _render_once(options) #:nodoc: + _template_renderer.render_once(options) + end + def _render_template(options) #:nodoc: _template_renderer.render(options) end |