From e0402fe0329fb4f631f49ddee466caace8ece192 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Tue, 1 Apr 2008 20:35:56 +0000 Subject: [PATCH] Add config.active_support for future configuration options. Also, add more new Rails 3 config settings to new_rails_defaults.rb [rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9204 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 2 ++ railties/configs/initializers/new_rails_defaults.rb | 6 ++++++ railties/lib/initializer.rb | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 86a31f1fbd..90e3a48102 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Add config.active_support for future configuration options. Also, add more new Rails 3 config settings to new_rails_defaults.rb [rick] + * Add Rails.logger, Rails.root, Rails.env and Rails.cache shortcuts for RAILS_* constants [pratik] * Allow files in plugins to be reloaded like the rest of the application. [rick] diff --git a/railties/configs/initializers/new_rails_defaults.rb b/railties/configs/initializers/new_rails_defaults.rb index 0cc1993ed9..d10b16b06e 100644 --- a/railties/configs/initializers/new_rails_defaults.rb +++ b/railties/configs/initializers/new_rails_defaults.rb @@ -3,3 +3,9 @@ # Only save the attributes that have changed since the record was loaded. ActiveRecord::Base.partial_updates = true + +# Include ActiveRecord class name as root for JSON serialized output. +ActiveRecord::Base.include_root_in_json = true + +# Use ISO 8601 format for JSON serialized times and dates +ActiveSupport.use_standard_json_time_format = true \ No newline at end of file diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index d929fe81e2..05a71e6065 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -416,6 +416,9 @@ module Rails base_class.send("#{setting}=", value) end end + configuration.active_support.each do |setting, value| + ActiveSupport.send("#{setting}=", value) + end end # Fires the user-supplied after_initialize block (Configuration#after_initialize) @@ -461,6 +464,9 @@ module Rails # A stub for setting options on ActiveRecord::Base attr_accessor :active_resource + # A stub for setting optinos on ActiveSupport + attr_accessor :active_support + # Whether or not classes should be cached (set to false if you want # application classes to be reloaded on each request) attr_accessor :cache_classes @@ -609,6 +615,7 @@ module Rails for framework in default_frameworks self.send("#{framework}=", Rails::OrderedOptions.new) end + self.active_support = Rails::OrderedOptions.new end # Set the root_path to RAILS_ROOT and canonicalize it.