aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch/routing/polymorphic_routes.rb')
-rw-r--r--actionpack/lib/action_dispatch/routing/polymorphic_routes.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
index e8ba1de40e..ecc1651dfe 100644
--- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
+++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -129,6 +129,9 @@ module ActionDispatch
if proxy
proxy.send(named_route, *args)
else
+ # we need to use url_for, because polymorphic_url can be used in context of other than
+ # current routes (e.g. engine's routes). As named routes from engine are not included
+ # calling engine's named route directly would fail.
url_for _routes.url_helpers.__send__("hash_for_#{named_route}", *args)
end
end