diff options
Diffstat (limited to 'railties/lib/rails/application.rb')
-rw-r--r-- | railties/lib/rails/application.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 0b72a7ed84..847445d29f 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -127,6 +127,28 @@ module Rails }) end + def ordered_railties + @ordered_railties ||= begin + order = config.railties_order.map do |railtie| + if railtie == :main_app + self + elsif railtie.respond_to?(:instance) + railtie.instance + else + railtie + end + end + + all = (railties.all - order) + all.push(self) unless all.include?(self) + order.push(:all) unless order.include?(:all) + + index = order.index(:all) + order[index] = all + order.reverse.flatten + end + end + def initializers Bootstrap.initializers_for(self) + super + |