lib/rails/application.rb in railties-4.2.0.beta1 vs lib/rails/application.rb in railties-4.2.0.beta2

- old
+ new

@@ -215,11 +215,11 @@ # development: # url: http://localhost:3001 # namespace: my_app_development # # # config/production.rb - # MyApp::Application.configure do + # Rails.application.configure do # config.middleware.use ExceptionNotifier, config_for(:exception_notification) # end def config_for(name) yaml = Pathname.new("#{paths["config"].existent.first}/#{name}.yml") @@ -412,12 +412,18 @@ end end end end + # Return an array of railties respecting the order they're loaded + # and the order specified by the +railties_order+ config. + # + # While when running initializers we need engines in reverse + # order here when copying migrations from railties we need then in the same + # order as given by +railties_order+ def migration_railties # :nodoc: - (ordered_railties & railties_without_main_app).reverse + ordered_railties.flatten - [self] end protected alias :build_middleware_stack :app @@ -446,15 +452,10 @@ def run_console_blocks(app) #:nodoc: railties.each { |r| r.run_console_blocks(app) } super end - def railties_without_main_app # :nodoc: - @railties_without_main_app ||= Rails::Railtie.subclasses.map(&:instance) + - Rails::Engine.subclasses.map(&:instance) - end - # Returns the ordered railties for this application considering railties_order. def ordered_railties #:nodoc: @ordered_railties ||= begin order = config.railties_order.map do |railtie| if railtie == :main_app @@ -470,16 +471,16 @@ all.push(self) unless (all + order).include?(self) order.push(:all) unless order.include?(:all) index = order.index(:all) order[index] = all - order.reverse.flatten + order end end def railties_initializers(current) #:nodoc: initializers = [] - ordered_railties.each do |r| + ordered_railties.reverse.flatten.each do |r| if r == self initializers += current else initializers += r.initializers end