From ddd85ef9c6a6297a8ff28816d907bbbf2eae5856 Mon Sep 17 00:00:00 2001 From: artemave Date: Fri, 17 Sep 2010 20:39:14 +0000 Subject: #948 template_inheritance --- actionpack/lib/abstract_controller/rendering.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/abstract_controller/rendering.rb') 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 -- cgit v1.2.3