diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-22 20:44:29 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-22 20:44:38 +0100 |
commit | c8cc8a987213bf90fe6922517d52befb7c0587a8 (patch) | |
tree | 55a434ec6ee336f97dc7e9e27c18d9c27d755d62 /activesupport | |
parent | 4ae79367277954bf6616151b03cbe0660808f9bd (diff) | |
download | rails-c8cc8a987213bf90fe6922517d52befb7c0587a8.tar.gz rails-c8cc8a987213bf90fe6922517d52befb7c0587a8.tar.bz2 rails-c8cc8a987213bf90fe6922517d52befb7c0587a8.zip |
Moved more configuration away from bootstrap.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/railtie.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb new file mode 100644 index 0000000000..18e404f002 --- /dev/null +++ b/activesupport/lib/active_support/railtie.rb @@ -0,0 +1,29 @@ +require "active_support" +require "rails" + +module ActiveSupport + class Railtie < Rails::Railtie + plugin_name :active_support + + # 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 |app| + require 'active_support/whiny_nil' if app.config.whiny_nils + end + + # Sets the default value for Time.zone + # If assigned value cannot be matched to a TimeZone, an exception will be raised. + initializer :initialize_time_zone do |app| + require 'active_support/core_ext/time/zones' + zone_default = Time.__send__(:get_zone, app.config.time_zone) + + unless zone_default + raise \ + 'Value assigned to config.time_zone not recognized.' + + 'Run "rake -D time" for a list of tasks for finding appropriate time zone names.' + end + + Time.zone_default = zone_default + end + end +end
\ No newline at end of file |