From 39766a9b4cde8f75a5837442b876e1e11a16ece4 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Sat, 17 Dec 2005 06:38:06 +0000 Subject: Don't include a layout when rendering an rjs template using render's :template option. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3316 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'actionpack/lib/action_controller/base.rb') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 9aab2c5028..c1adbf3b8a 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -937,7 +937,17 @@ module ActionController #:nodoc: end def default_template_name(default_action_name = action_name) + default_action_name = default_action_name.dup + strip_out_controller!(default_action_name) if template_path_includes_controller?(default_action_name) "#{self.class.controller_path}/#{default_action_name}" end + + def strip_out_controller!(path) + path.replace path.split('/', 2).last + end + + def template_path_includes_controller?(path) + path.to_s['/'] && self.class.controller_path.split('/')[-1] == path.split('/')[0] + end end end -- cgit v1.2.3