according to rails’ built-in validation functions, what is the difference between these following two methods?
validates :password, :confirmation =>true
and
validates_confirmation_of :password
as far as I understand, the first was just introduced in rails version 3?
am I correct?
They both do the same exact thing,
validates_confirmation_ofis just one of the many short form helper methods forvalidates.If you look at the source, you can see that the
validatesmethod is just written to handle all validators whereasvalidates_confirmation_ofexplicitly uses theConfirmationValidatorI think
validates_confirmation_ofwas introduced in Rails 2 so it’s been around for quite a while.Source comparison:
and