method
route_for
rails latest stable - Class:
ActionDispatch::Routing::UrlFor
route_for(name, *args)public
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
This maintains the context of the original caller on whether to return a path or full URL, e.g:
threadable_path(threadable) # => "/buckets/1" threadable_url(threadable) # => "http://example.com/buckets/1"