mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add short note on using url_for instead of directly calling named route in polymorphic_url
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user