Browse files

Fix railties_order when application object is passed

railites_order method, introduced in 40b19e0, had a bug that was causing
loading application instance twice in initializers if railties_order
already included application instance. So for example

    railties_order = [Foo::Engine, :main_app, Bar::Engine]

would result in such railties array:

    [MyApp::Application, Foo::Engine, MyAppApplication, Bar::Engine]

In order to fix it, we need to check for existence of application in
both railties_order and railties arrays.
  • Loading branch information...
1 parent 81ad94e commit 0e69705b0fc7501bada74b3ca023ae7f7b2b8592 @drogus drogus committed May 27, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/application.rb
  2. +4 −0 railties/test/railties/engine_test.rb
@@ -188,7 +188,7 @@ def ordered_railties #:nodoc:
all = (railties.all - order)
- all.push(self) unless all.include?(self)
+ all.push(self) unless (all + order).include?(self)
order.push(:all) unless order.include?(:all)
index = order.index(:all)
@@ -752,6 +752,10 @@ def bar
assert_equal "// App's bar js\n;", last_response.body.strip
+ # ensure that railties are not added twice
+ railties =
+ assert_equal railties, railties.uniq
test "railties_order adds :all with lowest priority if not given" do

0 comments on commit 0e69705

Please sign in to comment.