aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/rendering.rb
diff options
context:
space:
mode:
authorartemave <artemave@gmail.com>2010-09-17 20:39:14 +0000
committerwycats <wycats@gmail.com>2010-12-26 22:32:15 -0800
commitddd85ef9c6a6297a8ff28816d907bbbf2eae5856 (patch)
treeb2ff8ede17f042e8e007c6103b4063ce7ac75383 /actionpack/lib/abstract_controller/rendering.rb
parent9bac649fa4ca6f05795e7cab8d30049aa2410cb8 (diff)
downloadrails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.tar.gz
rails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.tar.bz2
rails-ddd85ef9c6a6297a8ff28816d907bbbf2eae5856.zip
#948 template_inheritance
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 91b75273fa..06f4441609 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -114,9 +114,17 @@ module AbstractController
view_context.render(options)
end
- # The prefix used in render "foo" shortcuts.
- def _prefix
- controller_path
+ # The prefixes used in render "foo" shortcuts.
+ def _prefixes
+ prefixes = [controller_path]
+ parent_controller = self.class.superclass
+
+ until parent_controller.abstract?
+ prefixes << parent_controller.controller_path
+ parent_controller = parent_controller.superclass
+ end
+
+ prefixes
end
private
@@ -156,7 +164,7 @@ module AbstractController
end
if (options.keys & [:partial, :file, :template, :once]).empty?
- options[:prefix] ||= _prefix
+ options[:prefixes] ||= _prefixes
end
options[:template] ||= (options[:action] || action_name).to_s