2010-01-22 14:44:29 -05:00
|
|
|
require "active_support"
|
2010-06-20 08:44:38 -04:00
|
|
|
require "active_support/i18n_railtie"
|
2010-01-22 14:44:29 -05:00
|
|
|
|
2010-01-24 19:06:12 -05:00
|
|
|
module ActiveSupport
|
|
|
|
class Railtie < Rails::Railtie
|
2010-03-26 13:47:55 -04:00
|
|
|
config.active_support = ActiveSupport::OrderedOptions.new
|
2010-01-24 19:06:12 -05:00
|
|
|
|
2010-06-29 15:18:17 -04:00
|
|
|
initializer "active_support.deprecation_behavior" do |app|
|
|
|
|
if deprecation = app.config.active_support.deprecation
|
|
|
|
ActiveSupport::Deprecation.behavior = deprecation
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-01-24 19:06:12 -05:00
|
|
|
# Sets the default value for Time.zone
|
|
|
|
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
|
2010-01-26 15:05:50 -05:00
|
|
|
initializer "active_support.initialize_time_zone" do |app|
|
2010-01-24 19:06:12 -05:00
|
|
|
require 'active_support/core_ext/time/zones'
|
2011-04-04 18:33:29 -04:00
|
|
|
zone_default = Time.find_zone!(app.config.time_zone)
|
2010-01-24 19:06:12 -05:00
|
|
|
|
|
|
|
unless zone_default
|
2012-03-15 23:54:39 -04:00
|
|
|
raise 'Value assigned to config.time_zone not recognized. ' \
|
2010-01-24 19:06:12 -05:00
|
|
|
'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
|
|
|
|
end
|
|
|
|
|
|
|
|
Time.zone_default = zone_default
|
|
|
|
end
|
|
|
|
end
|
2010-06-29 22:50:41 -04:00
|
|
|
end
|