aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/components.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-06-21 00:31:43 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-06-21 00:31:43 +0000
commitbbc1351344dd47e88a0251ca9a0f6301301b1202 (patch)
treea1fa53505fef340f160437cc7e37da6ed98825af /actionpack/lib/action_controller/components.rb
parentd19e46421cbead18ab1a9f79081b99bf3e97dde5 (diff)
downloadrails-bbc1351344dd47e88a0251ca9a0f6301301b1202.tar.gz
rails-bbc1351344dd47e88a0251ca9a0f6301301b1202.tar.bz2
rails-bbc1351344dd47e88a0251ca9a0f6301301b1202.zip
Determine the correct template_root for deeply nested components. Closes #2841.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/components.rb')
-rw-r--r--actionpack/lib/action_controller/components.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb
index c746928697..7f7cb361f8 100644
--- a/actionpack/lib/action_controller/components.rb
+++ b/actionpack/lib/action_controller/components.rb
@@ -75,8 +75,8 @@ module ActionController #:nodoc:
# will also use /code/weblog/components as template root
# and find templates in /code/weblog/components/admin/parties/users/
def uses_component_template_root
- path_of_calling_controller = File.dirname(caller[0].split(/:\d+:/).first)
- path_of_controller_root = path_of_calling_controller.sub(/#{controller_path.split("/")[0..-2]}$/, "") # " (for ruby-mode)
+ path_of_calling_controller = File.dirname(caller[0].split(/:\d+:/, 2).first)
+ path_of_controller_root = path_of_calling_controller.sub(/#{Regexp.escape(File.dirname(controller_path))}$/, "")
self.template_root = path_of_controller_root
end