mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Setting UrlFor in with_routing is no longer needed now that it's not global
This commit is contained in:
@@ -144,15 +144,12 @@ module ActionDispatch
|
||||
def with_routing
|
||||
old_routes, @router = @router, ActionDispatch::Routing::RouteSet.new
|
||||
old_controller, @controller = @controller, @controller.clone if @controller
|
||||
# ROUTES TODO: Figure out this insanity
|
||||
silence_warnings { ::ActionController.const_set(:UrlFor, @router.url_helpers) }
|
||||
_router = @router
|
||||
@controller.singleton_class.send(:send, :include, @router.url_helpers) if @controller
|
||||
yield @router
|
||||
ensure
|
||||
@router = old_routes
|
||||
@controller = old_controller if @controller
|
||||
silence_warnings { ::ActionController.const_set(:UrlFor, @router.url_helpers) } if @router
|
||||
end
|
||||
|
||||
def method_missing(selector, *args, &block)
|
||||
|
||||
@@ -132,7 +132,8 @@ module AbstractController
|
||||
end
|
||||
|
||||
# We need to create a new class in order to install the new named route.
|
||||
kls = Class.new { include ActionController::UrlFor }
|
||||
kls = Class.new { include set.url_helpers }
|
||||
|
||||
controller = kls.new
|
||||
assert controller.respond_to?(:home_url)
|
||||
assert_equal 'http://www.basecamphq.com/home/sweet/home/again',
|
||||
@@ -153,7 +154,7 @@ module AbstractController
|
||||
match '/home/sweet/home/:user', :to => 'home#index', :as => :home
|
||||
end
|
||||
|
||||
kls = Class.new { include ActionController::UrlFor }
|
||||
kls = Class.new { include set.url_helpers }
|
||||
controller = kls.new
|
||||
|
||||
assert_equal 'http://www.basecamphq.com/subdir/home/sweet/home/again',
|
||||
@@ -171,7 +172,7 @@ module AbstractController
|
||||
end
|
||||
|
||||
# We need to create a new class in order to install the new named route.
|
||||
kls = Class.new { include ActionController::UrlFor }
|
||||
kls = Class.new { include set.url_helpers }
|
||||
controller = kls.new
|
||||
assert controller.respond_to?(:home_url)
|
||||
assert_equal '/brave/new/world',
|
||||
@@ -239,7 +240,7 @@ module AbstractController
|
||||
end
|
||||
|
||||
# We need to create a new class in order to install the new named route.
|
||||
kls = Class.new { include ActionController::UrlFor }
|
||||
kls = Class.new { include set.url_helpers }
|
||||
kls.default_url_options[:host] = 'www.basecamphq.com'
|
||||
|
||||
controller = kls.new
|
||||
|
||||
Reference in New Issue
Block a user