diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-08-25 15:59:25 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:14 +0200 |
commit | 706a3223a303d56feeee2cc7601da1bd9f381243 (patch) | |
tree | 727055c391718bac8232f9234efca93c69b4d1d2 /actionpack | |
parent | 613cbe1f0075eed7ebf1ac521e99f652f6891330 (diff) | |
download | rails-706a3223a303d56feeee2cc7601da1bd9f381243.tar.gz rails-706a3223a303d56feeee2cc7601da1bd9f381243.tar.bz2 rails-706a3223a303d56feeee2cc7601da1bd9f381243.zip |
Add short note on using url_for instead of directly calling named route in polymorphic_url
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 3 |
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 |