diff options
-rw-r--r-- | actionmailer/lib/action_mailer/railtie.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/deprecated.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/railtie.rb | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 9 | ||||
-rw-r--r-- | activesupport/lib/active_support/railtie.rb | 54 | ||||
-rw-r--r-- | railties/lib/generators/rails/app/templates/config/boot.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/engine/configuration.rb | 1 | ||||
-rw-r--r-- | railties/test/initializer/path_test.rb | 1 |
9 files changed, 45 insertions, 42 deletions
diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index fbbcf98854..7ed1519e36 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -8,15 +8,14 @@ module ActionMailer require "action_mailer/railties/subscriber" subscriber ActionMailer::Railties::Subscriber.new + initializer "action_mailer.logger" do + ActionMailer::Base.logger ||= Rails.logger + end + initializer "action_mailer.set_configs" do |app| app.config.action_mailer.each do |k,v| ActionMailer::Base.send "#{k}=", v end end - - # TODO: ActionController::Base.logger should delegate to its own config.logger - initializer "action_mailer.logger" do - ActionMailer::Base.logger ||= Rails.logger - end end end
\ No newline at end of file diff --git a/actionpack/lib/action_controller/deprecated.rb b/actionpack/lib/action_controller/deprecated.rb index 589061e77c..edc0e5b3fe 100644 --- a/actionpack/lib/action_controller/deprecated.rb +++ b/actionpack/lib/action_controller/deprecated.rb @@ -2,3 +2,4 @@ ActionController::AbstractRequest = ActionController::Request = ActionDispatch:: ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response ActionController::Routing = ActionDispatch::Routing ActionController::Routing::Routes = ActionDispatch::Routing::RouteSet.new +ActionController::UrlWriter = AbstractController::UrlFor diff --git a/actionpack/lib/action_controller/railtie.rb b/actionpack/lib/action_controller/railtie.rb index f15c012471..29a0a346ec 100644 --- a/actionpack/lib/action_controller/railtie.rb +++ b/actionpack/lib/action_controller/railtie.rb @@ -8,17 +8,16 @@ module ActionController require "action_controller/railties/subscriber" subscriber ActionController::Railties::Subscriber.new + initializer "action_controller.logger" do + ActionController::Base.logger ||= Rails.logger + end + initializer "action_controller.set_configs" do |app| app.config.action_controller.each do |k,v| ActionController::Base.send "#{k}=", v end end - # TODO: ActionController::Base.logger should delegate to its own config.logger - initializer "action_controller.logger" do - ActionController::Base.logger ||= Rails.logger - end - initializer "action_controller.initialize_framework_caches" do ActionController::Base.cache_store ||= RAILS_CACHE end diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 7b6d792931..18d7cc0187 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -23,6 +23,10 @@ module ActiveRecord ActiveRecord::Base.default_timezone = :utc end + initializer "active_record.logger" do + ActiveRecord::Base.logger ||= ::Rails.logger + end + initializer "active_record.set_configs" do |app| app.config.active_record.each do |k,v| ActiveRecord::Base.send "#{k}=", v @@ -71,11 +75,6 @@ module ActiveRecord end end - # TODO: ActiveRecord::Base.logger should delegate to its own config.logger - initializer "active_record.logger" do - ActiveRecord::Base.logger ||= ::Rails.logger - end - initializer "active_record.i18n_deprecation" do require 'active_support/i18n' diff --git a/activesupport/lib/active_support/railtie.rb b/activesupport/lib/active_support/railtie.rb index 55608ac1c5..bc0f99869c 100644 --- a/activesupport/lib/active_support/railtie.rb +++ b/activesupport/lib/active_support/railtie.rb @@ -1,6 +1,33 @@ require "active_support" require "rails" +module ActiveSupport + class Railtie < Rails::Railtie + railtie_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 + module I18n class Railtie < Rails::Railtie railtie_name :i18n @@ -30,31 +57,4 @@ module I18n I18n.reload! end end -end - -module ActiveSupport - class Railtie < Rails::Railtie - railtie_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 diff --git a/railties/lib/generators/rails/app/templates/config/boot.rb b/railties/lib/generators/rails/app/templates/config/boot.rb index cbfa5ca3e9..e91304451b 100644 --- a/railties/lib/generators/rails/app/templates/config/boot.rb +++ b/railties/lib/generators/rails/app/templates/config/boot.rb @@ -20,6 +20,7 @@ require 'rails/all' # and list the framework railties that you want: # # require "active_support/railtie" +# require "active_model/railtie" # require "active_record/railtie" # require "action_controller/railtie" # require "action_view/railtie" @@ -27,6 +28,7 @@ require 'rails/all' # require "active_resource/railtie" <% else -%> # Pick the frameworks you want: +# require "active_model/railtie" # require "active_record/railtie" require "active_support/railtie" require "action_controller/railtie" diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 623555e7c1..b7a39fd5a7 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -10,6 +10,7 @@ require 'rails/deprecation' require 'rails/subscriber' require 'rails/ruby_version_check' +require 'active_support/railtie' require 'action_dispatch/railtie' # For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index a328e14170..c4e34b11b8 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -16,6 +16,7 @@ module Rails paths.app "app", :eager_load => true, :glob => "*" paths.app.controllers "app/controllers", :eager_load => true paths.app.helpers "app/helpers", :eager_load => true + paths.app.models "app/models", :eager_load => true paths.app.metals "app/metal" paths.app.views "app/views" paths.lib "lib", :load_path => true diff --git a/railties/test/initializer/path_test.rb b/railties/test/initializer/path_test.rb index 7a40d7fa6e..2048dc57bb 100644 --- a/railties/test/initializer/path_test.rb +++ b/railties/test/initializer/path_test.rb @@ -37,6 +37,7 @@ module InitializerTests end test "booting up Rails yields a valid paths object" do + assert_path @paths.app.models, "app", "models" assert_path @paths.app.metals, "app", "metal" assert_path @paths.app.helpers, "app", "helpers" assert_path @paths.app.views, "app", "views" |