File tree Expand file tree Collapse file tree 5 files changed +14
-2
lines changed
actionpack/lib/action_dispatch
lib/rails/commands/routes Expand file tree Collapse file tree 5 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,6 @@ class Railtie < Rails::Railtie # :nodoc:
68
68
config . action_dispatch . always_write_cookie = Rails . env . development? if config . action_dispatch . always_write_cookie . nil?
69
69
ActionDispatch ::Cookies ::CookieJar . always_write_cookie = config . action_dispatch . always_write_cookie
70
70
71
- ActionDispatch ::Routing ::Mapper . route_source_locations = Rails . env . development?
72
-
73
71
ActionDispatch ::Http ::Cache ::Request . strict_freshness = app . config . action_dispatch . strict_freshness
74
72
ActionDispatch . test_app = app
75
73
end
Original file line number Diff line number Diff line change 6
6
require "active_support/core_ext/enumerable"
7
7
require "active_support/core_ext/array/extract_options"
8
8
require "active_support/core_ext/regexp"
9
+ require "action_dispatch/routing"
9
10
require "action_dispatch/routing/redirection"
10
11
require "action_dispatch/routing/endpoint"
11
12
Original file line number Diff line number Diff line change
1
+ * Enable tracking route source locations only when using routes command. Previously,
2
+ it was enabled in development mode, but is only needed for ` bin/rails routes -E ` .
3
+
4
+ * Gannon McGibbon*
5
+
1
6
* Deprecate ` bin/rake stats ` in favor of ` bin/rails stats ` .
2
7
3
8
* Juan Vásquez*
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ def invoke_command(*)
22
22
23
23
desc "routes" , "List all the defined routes"
24
24
def perform ( *)
25
+ require "action_dispatch/routing/mapper"
26
+ ActionDispatch ::Routing ::Mapper . route_source_locations = true
25
27
boot_application!
26
28
require "action_dispatch/routing/inspector"
27
29
Original file line number Diff line number Diff line change @@ -403,6 +403,12 @@ class Rails::Command::RoutesTest < ActiveSupport::TestCase
403
403
assert_includes ( output , "No unused routes found." )
404
404
end
405
405
406
+ test "route source locations aren't included when booted normally" do
407
+ output = rails "runner" , "print !!ActionDispatch::Routing::Mapper.route_source_locations"
408
+
409
+ assert_equal ( "false" , output )
410
+ end
411
+
406
412
private
407
413
def run_routes_command ( args = [ ] )
408
414
rails "routes" , args
You can’t perform that action at this time.
0 commit comments