mirror of https://github.com/rails/rails
ask the named routes collection if the route is defined
we should not be accessing internals to figure out if a method is defined.
This commit is contained in:
parent
0088b08dca
commit
f889831ed6
|
@ -94,6 +94,10 @@ module ActionDispatch
|
|||
@module = Module.new
|
||||
end
|
||||
|
||||
def route_defined?(name)
|
||||
@module.method_defined? name
|
||||
end
|
||||
|
||||
def helper_names
|
||||
@helpers.map(&:to_s)
|
||||
end
|
||||
|
|
|
@ -165,7 +165,7 @@ module ActionDispatch
|
|||
|
||||
# ROUTES TODO: These assertions should really work in an integration context
|
||||
def method_missing(selector, *args, &block)
|
||||
if defined?(@controller) && @controller && @routes && @routes.named_routes.helpers.include?(selector)
|
||||
if defined?(@controller) && @controller && @routes && @routes.named_routes.route_defined?(selector)
|
||||
@controller.send(selector, *args, &block)
|
||||
else
|
||||
super
|
||||
|
|
Loading…
Reference in New Issue