diff options
author | Andrew White <pixeltrix@users.noreply.github.com> | 2017-03-17 17:07:09 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2017-03-17 18:07:09 +0100 |
commit | 35afd2c53b4a49a6b4495b167eef233428123b4a (patch) | |
tree | b463340347a72602473c90aa1d2a4a8b6728b14f /activerecord/test/models/bird.rb | |
parent | 7413be0d31ec7eacc6f93e26546cb02ac6db73ca (diff) | |
download | rails-35afd2c53b4a49a6b4495b167eef233428123b4a.tar.gz rails-35afd2c53b4a49a6b4495b167eef233428123b4a.tar.bz2 rails-35afd2c53b4a49a6b4495b167eef233428123b4a.zip |
Add support for calling nested direct routes (#28462)
Not all requirements can be expressed in terms of polymorphic url
options so add a `route_for` method that allows calling another
direct route (or regular named route) which a set of arguments, e.g:
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, e.g.
threadable_path(threadable) # => /buckets/1
threadable_url(threadable) # => http://example.com/buckets/1
Diffstat (limited to 'activerecord/test/models/bird.rb')
0 files changed, 0 insertions, 0 deletions