Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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

Be explicit about allowed constraint values, fixes #14702
  • Loading branch information...
commit 08775e347f40e60374a0661e97fa21edbfbbf403 2 parents d91117f + aca64fe
@rafaelfranca rafaelfranca authored
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.
Something went wrong with that request. Please try again.