aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/routing.textile
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-04-01 19:53:29 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-04-01 19:53:29 +0530
commitcf182988f501a4a07a2e82295859aff6ddaacaf9 (patch)
tree4385c13cfff920d43c59506144b5f99d53c0c9f3 /guides/source/routing.textile
parenteb154c529991ed77cd13035e6582178156ba9b32 (diff)
parenta5a9fc9afb77633fb16bb29e8d26b4c44958d82c (diff)
downloadrails-cf182988f501a4a07a2e82295859aff6ddaacaf9.tar.gz
rails-cf182988f501a4a07a2e82295859aff6ddaacaf9.tar.bz2
rails-cf182988f501a4a07a2e82295859aff6ddaacaf9.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'guides/source/routing.textile')
-rw-r--r--guides/source/routing.textile11
1 files changed, 11 insertions, 0 deletions
diff --git a/guides/source/routing.textile b/guides/source/routing.textile
index e93b1280e0..75f4e82918 100644
--- a/guides/source/routing.textile
+++ b/guides/source/routing.textile
@@ -535,6 +535,17 @@ TwitterClone::Application.routes.draw do
end
</ruby>
+You can also specify constraints as a lambda:
+
+<ruby>
+TwitterClone::Application.routes.draw do
+ match "*path" => "blacklist#index",
+ :constraints => lambda { |request| Blacklist.retrieve_ips.include?(request.remote_ip) }
+end
+</ruby>
+
+Both the +matches?+ method and the lambda gets the +request+ object as an argument.
+
h4. Route Globbing
Route globbing is a way to specify that a particular parameter should be matched to all the remaining parts of a route. For example