lib/rails/application.rb in railties-4.0.10.rc1 vs lib/rails/application.rb in railties-4.0.10.rc2
- old
+ new
@@ -233,12 +233,18 @@
def helpers_paths #:nodoc:
config.helpers_paths
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
@@ -268,15 +274,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
@@ -292,16 +293,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