diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-14 09:27:18 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-14 09:27:18 +0200 |
commit | 37d78028b235f04b2d3ca5cd88b7e1e0ad218684 (patch) | |
tree | d89694e106cbc3353ac1b0eeaf257ea91b3a7b01 /actionpack/lib/action_view | |
parent | c7aea81a39e130bfddd26537dea5f3626e2a009e (diff) | |
download | rails-37d78028b235f04b2d3ca5cd88b7e1e0ad218684.tar.gz rails-37d78028b235f04b2d3ca5cd88b7e1e0ad218684.tar.bz2 rails-37d78028b235f04b2d3ca5cd88b7e1e0ad218684.zip |
render :once should consider the current controller prefix.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderer/partial_renderer.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderer/template_renderer.rb | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index a7a6bbd3a4..1beae37af3 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -224,6 +224,10 @@ module ActionView #:nodoc: @controller_path ||= controller && controller.controller_path end + def controller_prefix + @controller_prefix ||= controller && controller._prefix + end + ActiveSupport.run_load_hooks(:action_view, self) end end diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index eff425687b..c580397cad 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -110,7 +110,7 @@ module ActionView end def find_template(path=@path, locals=@locals.keys) - prefix = @view.controller_path unless path.include?(?/) + prefix = @view.controller_prefix unless path.include?(?/) @lookup_context.find_template(path, prefix, true, locals) end @@ -151,7 +151,7 @@ module ActionView object = object.to_model if object.respond_to?(:to_model) object.class.model_name.partial_path.dup.tap do |partial| - path = @view.controller_path + path = @view.controller_prefix partial.insert(0, "#{File.dirname(path)}/") if partial.include?(?/) && path.include?(?/) end end diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index a9076760c5..34b2f26199 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -21,7 +21,8 @@ module ActionView def render_once(options) paths, locals = options[:once], options[:locals] || {} - layout, keys, prefix = options[:layout], locals.keys, options[:prefix] + layout, keys = options[:layout], locals.keys + prefix = options.fetch(:prefix, @view.controller_prefix) raise "render :once expects a String or an Array to be given" unless paths |