rails/rails — pull request #8122 by bcardarella (2012-11-05 21:59:22+00:00)
Title: Don't allow confirmation to pass if confirmation value is nil and doesn't match value

Now that the validator has been put on the confirmation attribute there is the possibility of the confirmation validator passing when it shouldn't.

This fix resolves the following usecase:

```ruby
class User < ActiveRecord::Base
attr_accessor :password
validates :password => { :confirmation => true }
end

u = User.new(:password => 'test')
u.valid?
# => true
```

The logic in the validator would skip if `password_confirmation` evaluates to `nil` which is very likely for many cases.