aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorArthur Nogueira Neves <github@arthurnn.com>2015-08-11 16:10:41 +0200
committerArthur Nogueira Neves <github@arthurnn.com>2015-08-11 16:10:41 +0200
commit2117a535b5ab5d88ccb9834fa14b28863ffb69cc (patch)
tree25879197ab16db998e28f581b2a1d301e76ce2fe /actionview
parentcd3983a95a82ff361e111df02006549d88e71dbe (diff)
parent0ffaa56d51e8e0213db250ea36221c232a0c92f3 (diff)
downloadrails-2117a535b5ab5d88ccb9834fa14b28863ffb69cc.tar.gz
rails-2117a535b5ab5d88ccb9834fa14b28863ffb69cc.tar.bz2
rails-2117a535b5ab5d88ccb9834fa14b28863ffb69cc.zip
Merge pull request #21187 from arthurnn/method_missing_routes_av
Dont try to call method missing in routes if thats not what we want
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/test_case.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb
index c4bc26ca8a..f6b5696a13 100644
--- a/actionview/lib/action_view/test_case.rb
+++ b/actionview/lib/action_view/test_case.rb
@@ -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