Validates_confirmation_of not working


I’ve got a really weird problem with validates_confirmation_of. I’ve
been developing my app for quite some time and everything went fine so
far. After (more or less) a month of coding I got back to check my user
registration code and noticed that validates_confirmation_of doesn’t
work any more. The code looks 100% correct to me:

class User < ActiveRecord::Base
attr_accessible :login, :password, :email

validates_presence_of :login, :password, :email
validates_uniqueness_of :login, :email

validates_length_of :login,  :within => 4..40
validates_length_of :password, :within => 5..40

validates_format_of :login, :with => /^[a-zA-z0-9_\-]{4,30}$/
validates_format_of :email, :with => /^[_a-z0 -9-]+(\.[_a 

-z0-9-]+)@[a-z0-9-]+(.[a-z0 -9-]+)(.[a-z]{2,4})$/i

validates_confirmation_of :email, :if => {|u| > 

validates_confirmation_of :password :if => {|u|
u.password.size > 0}

Other validation methods work fine. Have you seen a similar problem
before? What can be wrong with it?

(I’m running Rails 1.1.2 on my local machine)

i’ve been having a lot of problems with that validation.

while running a webserver the error gets added/displayed correctly, but
in console and unit tests it fails to throw an error. I’m still trying
to figure out why.

rails 1.1.6

i’m sorry, my error is in validated acceptance of, not confirmation

I’ve finally found a solution:

This ticket has been open for a year :expressionless: If this defect can’t be fixed,
it should be at least documented in manual.