Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Option :case_sensitive for validates_exclusion_of

#1511

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

Reported by awendt · December 3rd, 2008 @ 08:29 AM

State: wontfix
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. awendt
    awendt

    Please bear with me, I noticed I've attached the reverse patch. Here is the correct one.

    December 3rd, 2008 @ 08:32 AM

  2. awendt
  3. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to wontfix

    You should just use validates_format_of and a regular expression.

    Thanks.

    March 8th, 2009 @ 12:50 PM

  4. José Valim
    José Valim

    +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.

    March 8th, 2009 @ 04:44 PM