Skip to content

Instantly share code, notes, and snippets.

@adkron
Created April 8, 2016 17:52
Show Gist options
  • Save adkron/c41734d970f32441b3b32b218f4ddddb to your computer and use it in GitHub Desktop.
Save adkron/c41734d970f32441b3b32b218f4ddddb to your computer and use it in GitHub Desktop.
class PasswordFormatValidator < ActiveModel::EachValidator
def validate_each(record, attr_name, value)
PasswordValidationRules.new(value).errors.each do |error|
record.errors.add(attr_name, error)
end
#if value != record.password_confirmation
#record.errors.add(:password_confirmation, I18n.t('views.project.flash_messages.password_does_not_match_confirmation'))
#end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment