This project is archived and is in readonly mode.

#5369 ✓invalid
Robert Wünsch

Validates Format is NOT Case Sensitive

Reported by Robert Wünsch | August 12th, 2010 @ 10:36 PM

Using "validates :name, :format => { :with => /[a-z]+/ }" matches abc and ABC. It should only match abc whereas /[a-z]+/i should match it all.

Comments and changes to this ticket

  • Srinivas Aki

    Srinivas Aki August 14th, 2010 @ 11:30 PM

    Robert,

    I could not reproduce the issue. Can you elaborate a little bit on what you were trying to do.

    Thanks
    Srini

  • Rohit Arondekar

    Rohit Arondekar August 26th, 2010 @ 04:03 AM

    • State changed from “new” to “needs-more-info”
    • Importance changed from “” to “Low”

    I could not reproduce this on the 3-0-stable branch.

    I did the following:

    • Create a new app
    • Create a Post scaffold with title field
    • Add the validation: validates :title, :format => { :with => /[a-z]+/ }
    • Try the following in console
    ruby-1.9.2-p0 > p = Post.new :title => 'ABC'
     => #<Post id: nil, title: "ABC", created_at: nil, updated_at: nil> 
    ruby-1.9.2-p0 > p.save
     => false 
    ruby-1.9.2-p0 > p.errors
     => {:title=>["is invalid"]} 
    
    ruby-1.9.2-p0 > valid_p = Post.new :title => 'abc'
     => #<Post id: nil, title: "abc", created_at: nil, updated_at: nil> 
    ruby-1.9.2-p0 > valid_p.save
     => true
    

    Are there any other steps that need to be followed to reproduce this issue?

  • Robert Wünsch

    Robert Wünsch August 26th, 2010 @ 11:26 AM

    After updating to Rails 3.0 release candidate 2 the problem no longer occurs.

  • Rohit Arondekar

    Rohit Arondekar August 26th, 2010 @ 11:33 AM

    • State changed from “needs-more-info” to “invalid”

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>

Pages