class ActiveModel::Validations::ConfirmationValidator
def setup(klass)
def setup(klass) klass.send(:attr_accessor, *attributes.map do |attribute| :"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation") end.compact) end
def validate_each(record, attribute, value)
def validate_each(record, attribute, value) confirmed = record.send(:"#{attribute}_confirmation") return if confirmed.nil? || value == confirmed record.errors.add(attribute, :confirmation, options) end