aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base.rb
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-03-13 15:54:33 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-03-13 15:54:33 +0000
commit8ff44631939fd9220f03f9b18a687cbd040220e3 (patch)
treea429e1a94d8e6d102e9d45b62fc2b330478371b9 /actionpack/lib/action_controller/base.rb
parent97dd9a91c249ec8717cb07e1f6a08b58f3544a5d (diff)
downloadrails-8ff44631939fd9220f03f9b18a687cbd040220e3.tar.gz
rails-8ff44631939fd9220f03f9b18a687cbd040220e3.tar.bz2
rails-8ff44631939fd9220f03f9b18a687cbd040220e3.zip
Simplify controller_path
Cache File.directory? calls to avoid filesystem calls when using layouts git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3861 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/base.rb')
-rwxr-xr-xactionpack/lib/action_controller/base.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index bcfea86ac4..afb17d7655 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -348,13 +348,7 @@ module ActionController #:nodoc:
# Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
def controller_path
- unless @controller_path
- components = self.name.to_s.split('::')
- components[-1] = $1 if /^(.*)Controller$/ =~ components.last
- @controller_path = components.map { |name| name.underscore }.join('/')
- end
-
- @controller_path
+ @controller_path ||= name.gsub(/Controller$/, '').underscore
end
# Return an array containing the names of public methods that have been marked hidden from the action processor.