This project is archived and is in readonly mode.
Option :case_sensitive for validates_exclusion_of
Reported by awendt | December 3rd, 2008 @ 08:29 AM | in 2.x
Wherever you look, the example for uses of validates_exclusion_of is to reserve usernames. I recently found out that validates_exclusion_of is case sensitive: Why, however, would I want to exclude "admin" if users can still sign up as "Admin"?
I've developed on a patch that introduces a :case_sensitive option to validates_exclusion_of -- so that I am not forced to using validates_each just because I want to prevent users to sign up as "admin" in upper or lower case.
I will also push the patch to github.com/awendt/rails
Comments and changes to this ticket
-
awendt December 3rd, 2008 @ 08:32 AM
Please bear with me, I noticed I've attached the reverse patch. Here is the correct one.
-
awendt December 3rd, 2008 @ 08:43 AM
The code can be reviewed at http://github.com/awendt/rails/c...
-
Pratik March 8th, 2009 @ 12:50 PM
- Assigned user set to Pratik
- State changed from new to wontfix
You should just use validates_format_of and a regular expression.
Thanks.
-
José Valim March 8th, 2009 @ 04:44 PM
+1
I think that a case sensitive option make sense also.
But it should be also included in validate_inclusion_of. Maybe post this in the Rails group and try to get a couple more +1.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>