diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-14 19:53:07 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-15 12:24:30 +0100 |
commit | 8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8 (patch) | |
tree | 976072122a45b4d050a0d6e798ae55ac3fea67a7 /railties/lib | |
parent | 5a8e7287c542cbe82d3127cae83dab8571ab9114 (diff) | |
download | rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.tar.gz rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.tar.bz2 rails-8c8942ed4f2da52aa42ccd46560acb0b5fd37cb8.zip |
Move Dispatcher setup to Railties and add instrumentation hook.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/bootstrap.rb | 21 | ||||
-rw-r--r-- | railties/lib/rails/dispatcher.rb | 2 |
2 files changed, 17 insertions, 6 deletions
diff --git a/railties/lib/rails/bootstrap.rb b/railties/lib/rails/bootstrap.rb index 8a65b3fa98..b7cf70747a 100644 --- a/railties/lib/rails/bootstrap.rb +++ b/railties/lib/rails/bootstrap.rb @@ -80,10 +80,7 @@ module Rails end end - # Sets the logger for Active Record, Action Controller, and Action Mailer - # (but only for those frameworks that are to be loaded). If the framework's - # logger is already set, it is not changed, otherwise it is set to use - # RAILS_DEFAULT_LOGGER. + # Sets the logger for dependencies and cache store. initializer :initialize_framework_logging do ActiveSupport::Dependencies.logger ||= Rails.logger Rails.cache.logger ||= Rails.logger @@ -99,7 +96,7 @@ module Rails # Loads support for "whiny nil" (noisy warnings when methods are invoked # on +nil+ values) if Configuration#whiny_nils is true. initializer :initialize_whiny_nils do - require('active_support/whiny_nil') if config.whiny_nils + require 'active_support/whiny_nil' if config.whiny_nils end # Sets the default value for Time.zone @@ -120,6 +117,8 @@ module Rails # Set the i18n configuration from config.i18n but special-case for the load_path which should be # appended to what's already set instead of overwritten. initializer :initialize_i18n do + require 'active_support/i18n' + config.i18n.each do |setting, value| if setting == :load_path I18n.load_path += value @@ -127,6 +126,18 @@ module Rails I18n.send("#{setting}=", value) end end + + ActionDispatch::Callbacks.to_prepare do + I18n.reload! + end + end + + initializer :set_clear_dependencies_hook do + unless config.cache_classes + ActionDispatch::Callbacks.after do + ActiveSupport::Dependencies.clear + end + end end initializer :initialize_notifications do diff --git a/railties/lib/rails/dispatcher.rb b/railties/lib/rails/dispatcher.rb index 7f9a6221d9..5d383eacd1 100644 --- a/railties/lib/rails/dispatcher.rb +++ b/railties/lib/rails/dispatcher.rb @@ -20,5 +20,5 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #++ -require 'action_controller/dispatch/dispatcher' +require 'action_controller/deprecated/dispatcher' Dispatcher = ActionController::Dispatcher |