diff options
author | thedarkone <thedarkone2@gmail.com> | 2010-09-27 14:50:39 +0200 |
---|---|---|
committer | thedarkone <thedarkone2@gmail.com> | 2010-09-27 17:45:58 +0200 |
commit | 918dc27345319fbabf25a43bd65b613878b3a66e (patch) | |
tree | 9384f88171b155ac6655d70c2448e4e8a364fe32 /actionpack/lib | |
parent | 7918a5c96604b6c2d8a60542b7afc9e445c43fba (diff) | |
download | rails-918dc27345319fbabf25a43bd65b613878b3a66e.tar.gz rails-918dc27345319fbabf25a43bd65b613878b3a66e.tar.bz2 rails-918dc27345319fbabf25a43bd65b613878b3a66e.zip |
Compile ActionController::Base.config's methods to avoid method_missing overhead.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_view/base.rb | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index aea28d9265..4c57d82f1c 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -26,6 +26,10 @@ module ActionController options.stylesheets_dir ||= paths.public.stylesheets.to_a.first options.page_cache_directory ||= paths.public.to_a.first + # make sure readers methods get compiled + options.asset_path ||= nil + options.asset_host ||= nil + ActiveSupport.on_load(:action_controller) do include app.routes.mounted_helpers extend ::AbstractController::Railties::RoutesHelpers.with(app.routes) @@ -33,5 +37,11 @@ module ActionController options.each { |k,v| send("#{k}=", v) } end end + + config.after_initialize do + ActiveSupport.on_load(:action_controller) do + config.crystalize! if config.respond_to?(:crystalize!) + end + end end end diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 3fa46d0f43..0bef3e3a08 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -209,8 +209,7 @@ module ActionView #:nodoc: @_request = controller.request if controller.respond_to?(:request) end - config = controller && controller.respond_to?(:config) ? controller.config : {} - @_config = ActiveSupport::InheritableOptions.new(config) + @_config = controller && controller.respond_to?(:config) ? controller.config.inheritable_copy : {} @_content_for = Hash.new { |h,k| h[k] = ActiveSupport::SafeBuffer.new } @_virtual_path = nil |