Source: show | on GitHub
# File activemodel/lib/active_model/validations/confirmation.rb, line 11 def setup(klass) klass.send(:attr_accessor, *attributes.map do |attribute| :"#{attribute}_confirmation" unless klass.method_defined?(:"#{attribute}_confirmation") end.compact) end
# File activemodel/lib/active_model/validations/confirmation.rb, line 5 def validate_each(record, attribute, value) if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed) record.errors.add(attribute, :confirmation, options) end end