aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-08-09 03:06:08 -0300
committerYehuda Katz <wycats@gmail.com>2009-08-09 04:12:09 -0300
commit10eaba8f412d3acbdb6a57e1cd457e074c127953 (patch)
tree48db947fc8653d32a602c6b3182fe2a0b646db72 /actionpack
parente28e0611652e4d2c4fc2e8afdf866264c1583154 (diff)
downloadrails-10eaba8f412d3acbdb6a57e1cd457e074c127953.tar.gz
rails-10eaba8f412d3acbdb6a57e1cd457e074c127953.tar.bz2
rails-10eaba8f412d3acbdb6a57e1cd457e074c127953.zip
Cache controller_path on the AV instance to avoid needing to make additional calls back into the controller for each attempt (this was done because these calls were adding up significantly in partial rendering and showing up on profiles)
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/base.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index d1cd506dde..c3361c9367 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -195,7 +195,9 @@ module ActionView #:nodoc:
attr_internal :request, :layout
- delegate :controller_path, :to => :controller, :allow_nil => true
+ def controller_path
+ @controller_path ||= controller && controller.controller_path
+ end
delegate :request_forgery_protection_token, :template, :params, :session, :cookies, :response, :headers,
:flash, :action_name, :controller_name, :to => :controller