Browse files

Merge pull request #14707 from minio-sk/fix-issue-14702

Be explicit about allowed constraint values, fixes #14702
  • Loading branch information...
2 parents d91117f + aca64fe commit 08775e347f40e60374a0661e97fa21edbfbbf403 @rafaelfranca rafaelfranca committed Apr 11, 2014
Showing with 2 additions and 0 deletions.
  1. +2 −0 guides/source/
2 guides/source/
@@ -694,6 +694,8 @@ namespace :admin do
+NOTE: Request constraints work by calling a method on the <a href="action_controller_overview.html#the-request-object">Request object</a> with the same name as the hash key and then compare the return value with the hash value. Therefore, constraint values should match the corresponding Request object method return type. For example: `constraints: { subdomain: 'api' }` will match an `api` subdomain as expected, however using a symbol `constraints: { subdomain: :api }` will not, because `request.subdomain` returns `'api'` as a String.
### Advanced Constraints
If you have a more advanced constraint, you can provide an object that responds to `matches?` that Rails should use. Let's say you wanted to route all users on a blacklist to the `BlacklistController`. You could do:

0 comments on commit 08775e3

Please sign in to comment.