aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2018-03-08 09:49:36 +0000
committerGitHub <noreply@github.com>2018-03-08 09:49:36 +0000
commite764336e71c7dd386fbce36d0f916c41773a18cd (patch)
tree76737336cb1af491aee467bcc0c26c16f5be8897 /actionpack
parent6a54932d43da3b24a1a8f41575cfe65c6a18c6bd (diff)
parent046750aeeb71302fa27b63b74b5ae6cee9827401 (diff)
downloadrails-e764336e71c7dd386fbce36d0f916c41773a18cd.tar.gz
rails-e764336e71c7dd386fbce36d0f916c41773a18cd.tar.bz2
rails-e764336e71c7dd386fbce36d0f916c41773a18cd.zip
Merge pull request #32175 from bogdanvlviv/express-route_for-as-public-api
Express `ActionDispatch::Routing::UrlFor#route_for` as public api
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/url_for.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb
index fa345dccdf..922e776da9 100644
--- a/actionpack/lib/action_dispatch/routing/url_for.rb
+++ b/actionpack/lib/action_dispatch/routing/url_for.rb
@@ -191,7 +191,19 @@ module ActionDispatch
end
end
- def route_for(name, *args) # :nodoc:
+ # Allows calling direct or regular named route.
+ #
+ # resources :buckets
+ #
+ # direct :recordable do |recording|
+ # route_for(:bucket, recording.bucket)
+ # end
+ #
+ # direct :threadable do |threadable|
+ # route_for(:recordable, threadable.parent)
+ # end
+ #
+ def route_for(name, *args)
public_send(:"#{name}_url", *args)
end