diff options
author | Dan Jensen <djensen@addfour.co> | 2018-06-11 15:54:25 -0400 |
---|---|---|
committer | Dan Jensen <djensen@addfour.co> | 2018-06-11 15:54:25 -0400 |
commit | 7dbc6d6979aec1ce7364269360d277fa2499e919 (patch) | |
tree | 95e6607501abd4390d2a057e299d662ca8410d0b | |
parent | 4eb1481c7f66a5c378b218676ece43b8ae13e553 (diff) | |
download | rails-7dbc6d6979aec1ce7364269360d277fa2499e919.tar.gz rails-7dbc6d6979aec1ce7364269360d277fa2499e919.tar.bz2 rails-7dbc6d6979aec1ce7364269360d277fa2499e919.zip |
Fix bug with eager_load in development environment
Modifies the routes simulator to allow for empty RouteSets, which are
created when secondary Engines are loaded.
-rw-r--r-- | actionpack/lib/action_dispatch/journey/routes.rb | 2 | ||||
-rw-r--r-- | actionpack/test/journey/router_test.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/journey/routes.rb b/actionpack/lib/action_dispatch/journey/routes.rb index 639c063495..3ba8361d77 100644 --- a/actionpack/lib/action_dispatch/journey/routes.rb +++ b/actionpack/lib/action_dispatch/journey/routes.rb @@ -51,7 +51,7 @@ module ActionDispatch def ast @ast ||= begin asts = anchored_routes.map(&:ast) - Nodes::Or.new(asts) unless asts.empty? + Nodes::Or.new(asts) end end diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index 183f421bcf..1f4e14aef6 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -493,6 +493,15 @@ module ActionDispatch assert_not called end + def test_eager_load_with_routes + get "/foo-bar", to: "foo#bar" + assert_nil router.eager_load! + end + + def test_eager_load_without_routes + assert_nil router.eager_load! + end + private def get(*args) |