File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -590,7 +590,7 @@ def load_seed
590
590
config . eager_load_paths . freeze
591
591
end
592
592
593
- initializer :make_routes_lazy , before : :set_routes_reloader_hook do |app |
593
+ initializer :make_routes_lazy , before : :bootstrap_hook do |app |
594
594
config . route_set_class = LazyRouteSet if Rails . env . local?
595
595
end
596
596
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ class LazyRouteSetTest < ActiveSupport::TestCase
8
8
include ActiveSupport ::Testing ::Isolation
9
9
10
10
setup :build_app
11
-
12
11
teardown :teardown_app
13
12
14
13
test "app lazily loads routes when invoking url helpers" do
@@ -83,6 +82,21 @@ class LazyRouteSetTest < ActiveSupport::TestCase
83
82
assert_not_operator ( :plugin_posts_path , :in? , engine_url_helpers . methods )
84
83
end
85
84
85
+ test "railties can access lazy routes" do
86
+ app_file ( "config/application.rb" , <<~RUBY , "a+" )
87
+
88
+ class MyRailtie < ::Rails::Railtie
89
+ initializer :some_railtie_init do |app|
90
+ app.routes
91
+ end
92
+ end
93
+ RUBY
94
+
95
+ require "#{ app_path } /config/environment"
96
+
97
+ assert_operator ( Rails . application . routes , :is_a? , Engine ::LazyRouteSet )
98
+ end
99
+
86
100
private
87
101
def build_app
88
102
super
@@ -118,6 +132,7 @@ class Engine < ::Rails::Engine
118
132
end
119
133
end
120
134
RUBY
135
+
121
136
plugin . write "config/routes.rb" , <<~RUBY
122
137
Plugin::Engine.routes.draw do
123
138
root to: proc { [200, {}, []] }
You can’t perform that action at this time.
0 commit comments