Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add active_model/railtie back to generated boot.rb, add models back t…

…o paths, load active_support/railtie since we need it and ensure default logger is set before config.
  • Loading branch information...
commit 3b6f659fb6b1ffd323c0bbad36630cc97b96bd5f 1 parent 396003f
@josevalim josevalim authored
View
9 actionmailer/lib/action_mailer/railtie.rb
@@ -8,15 +8,14 @@ class Railtie < Rails::Railtie
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
View
1  actionpack/lib/action_controller/deprecated.rb
@@ -2,3 +2,4 @@
ActionController::AbstractResponse = ActionController::Response = ActionDispatch::Response
ActionController::Routing = ActionDispatch::Routing
ActionController::Routing::Routes = ActionDispatch::Routing::RouteSet.new
+ActionController::UrlWriter = AbstractController::UrlFor
View
9 actionpack/lib/action_controller/railtie.rb
@@ -8,17 +8,16 @@ class Railtie < Rails::Railtie
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
View
9 activerecord/lib/active_record/railtie.rb
@@ -23,6 +23,10 @@ class Railtie < Rails::Railtie
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 @@ class Railtie < Rails::Railtie
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'
View
54 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 @@ class Railtie < Rails::Railtie
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
View
2  railties/lib/generators/rails/app/templates/config/boot.rb
@@ -20,6 +20,7 @@
# 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 "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"
View
1  railties/lib/rails.rb
@@ -10,6 +10,7 @@
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
View
1  railties/lib/rails/engine/configuration.rb
@@ -16,6 +16,7 @@ def paths
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
View
1  railties/test/initializer/path_test.rb
@@ -37,6 +37,7 @@ def assert_not_in_load_path(*path)
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"
Please sign in to comment.
Something went wrong with that request. Please try again.