aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/journey/route.rb
diff options
context:
space:
mode:
authorHrvoje Šimić <shime@twobucks.co>2017-03-12 17:51:26 +0100
committerHrvoje Šimić <shime@twobucks.co>2017-03-13 17:05:12 +0100
commit1c6747999a74eac84d4e30d698f59c16e0309d64 (patch)
tree7830468ac8038636c75a0125925b4635b175b3fe /actionpack/lib/action_dispatch/journey/route.rb
parent4d5060072b5446e0d13873f7edbecaf3527e7846 (diff)
downloadrails-1c6747999a74eac84d4e30d698f59c16e0309d64.tar.gz
rails-1c6747999a74eac84d4e30d698f59c16e0309d64.tar.bz2
rails-1c6747999a74eac84d4e30d698f59c16e0309d64.zip
[docs] fix ActionDispatch documentation
Diffstat (limited to 'actionpack/lib/action_dispatch/journey/route.rb')
-rw-r--r--actionpack/lib/action_dispatch/journey/route.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb
index 927fd369c4..7bc15aa6b3 100644
--- a/actionpack/lib/action_dispatch/journey/route.rb
+++ b/actionpack/lib/action_dispatch/journey/route.rb
@@ -89,8 +89,15 @@ module ActionDispatch
end
end
+ # Needed for `rails routes`. Picks up succinctly defined requirements
+ # for a route, for example route
+ #
+ # get 'photo/:id', :controller => 'photos', :action => 'show',
+ # :id => /[A-Z]\d{5}/
+ #
+ # will have {:controller=>"photos", :action=>"show", :id=>/[A-Z]\d{5}/}
+ # as requirements.
def requirements
- # needed for rails `rails routes`
@defaults.merge(path.requirements).delete_if { |_, v|
/.+?/ == v
}