File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
lib/action_dispatch/routing Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -604,7 +604,7 @@ def url_options; {}; end
604
604
# `included` block is run only for the initial inclusion of each copy.
605
605
def self . included ( base )
606
606
super
607
- if !base . _routes . equal? ( @_proxy . _routes )
607
+ if base . respond_to? ( :_routes ) && !base . _routes . equal? ( @_proxy . _routes )
608
608
@dup_for_reinclude ||= self . dup
609
609
base . include @dup_for_reinclude
610
610
end
Original file line number Diff line number Diff line change @@ -301,6 +301,17 @@ def test_resolve_urls
301
301
assert_equal "http://www.example.com/manufacturers/apple" , Routes . url_helpers . polymorphic_url ( @manufacturer )
302
302
end
303
303
304
+ def test_url_helpers_module_can_be_included_directly_in_an_active_support_concern
305
+ concern = Module . new do
306
+ extend ActiveSupport ::Concern
307
+ include Routes . url_helpers
308
+ end
309
+
310
+ concerned = Class . new { include concern } . new
311
+
312
+ assert_equal "http://www.example.com/" , concerned . root_url
313
+ end
314
+
304
315
def test_defining_direct_inside_a_scope_raises_runtime_error
305
316
routes = ActionDispatch ::Routing ::RouteSet . new
306
317
You can’t perform that action at this time.
0 commit comments