1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #21187 from arthurnn/method_missing_routes_av

Dont try to call method missing in routes if thats not what we want
This commit is contained in:
Arthur Nogueira Neves 2015-08-11 16:10:41 +02:00
commit 2117a535b5

View file

@ -263,9 +263,15 @@ module ActionView
end
def method_missing(selector, *args)
if @controller.respond_to?(:_routes) &&
( @controller._routes.named_routes.route_defined?(selector) ||
@controller._routes.mounted_helpers.method_defined?(selector) )
begin
routes = @controller.respond_to?(:_routes) && @controller._routes
rescue
# Dont call routes, if there is an error on _routes call
end
if routes &&
( routes.named_routes.route_defined?(selector) ||
routes.mounted_helpers.method_defined?(selector) )
@controller.__send__(selector, *args)
else
super