mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add short note on using url_for instead of directly calling named route in polymorphic_url
This commit is contained in:
parent
613cbe1f00
commit
706a3223a3
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue