mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
4c34cb31fa
commit
cf992fba95
2 changed files with 5 additions and 1 deletions
|
@ -185,7 +185,7 @@ module Rails
|
|||
end
|
||||
|
||||
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)
|
||||
|
|
|
@ -1098,6 +1098,10 @@ YAML
|
|||
|
||||
get("/assets/bar.js")
|
||||
assert_equal "// App's bar js\n;", last_response.body.strip
|
||||
|
||||
# ensure that railties are not added twice
|
||||
railties = Rails.application.ordered_railties.map(&:class)
|
||||
assert_equal railties, railties.uniq
|
||||
end
|
||||
|
||||
test "railties_order adds :all with lowest priority if not given" do
|
||||
|
|
Loading…
Reference in a new issue