instance method
route_for
Ruby on Rails 7.2.3
Since v5.2.8.1Signature
route_for(name, *args)
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"
Parameters
-
namereq -
argsrest
Source
# File actionpack/lib/action_dispatch/routing/url_for.rb, line 222
def route_for(name, *args)
public_send(:"#{name}_url", *args)
end
Defined in actionpack/lib/action_dispatch/routing/url_for.rb line 222
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::UrlFor