Please read for an updated status on RailsCasts:
Learn more or hide this
GitHub User: juanpujol
This validation subject is getting complex...
Let's say I validate like this:
validates :password, :password_confirmation, :presence => true
and I use the tip above:
This works perfectly. But If I don't want the user to confirm the password every time he saves the profile I would do like this.
validates :password, :password_confirmation, :presence => true, :if => :password
This works too. Even validates on the reset password form and ask for confirmation if the password changes on the profile. But, it has a problem. if I submit the reset password form without any value for the password or password_confirmation it won't validate the presence of :password or :password_confirmation. The password won't be updated but it'll be nice to show the validation errors for presence in this scenario.
I don't know if any one has this issue, but I would appreciate some light here.