Sha256: 376e320eaaaa6381f1a14b3ae1c50445e8eaec0152f5d0aa918dc1bd6d91d803

Contents?: true

Size: 437 Bytes

Versions: 5

Compression:

Stored size: 437 Bytes

Contents

class PasswordConfirmationValidation < Validation
  def self.validate(params, field, name, value, record, errors)
    return if record.field_was(field.name).nil? || record.stash["current_#{name}"].nil? || !record.respond_to?(:passwords_match?)
    match = record.passwords_match?(record.stash["current_#{name}"])
    errors[field.name] << new(name) unless match
  end

  def describe
    "didn't match your existing #{params}"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yodel-0.0.7 lib/yodel/models/core/validations/password_confirmation_validation.rb
yodel-0.0.4 lib/yodel/models/core/validations/password_confirmation_validation.rb
yodel-0.0.3 lib/yodel/models/core/validations/password_confirmation_validation.rb
yodel-0.0.2 lib/yodel/models/core/validations/password_confirmation_validation.rb
yodel-0.0.1 lib/yodel/models/core/validations/password_confirmation_validation.rb