Почитай про: 
http://edgeguides.rubyonrails.org/active_record_validations.html#confirmation
і
https://github.com/plataformatec/devise/blob/master/lib/devise/models/validatable.rb