2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-12-19 15:12:03 -05:00
|
|
|
class PasswordValidator < ActiveModel::EachValidator
|
|
|
|
def validate_each(record, attribute, value)
|
2017-11-30 23:19:24 -05:00
|
|
|
return unless record.password_validation_required?
|
|
|
|
|
2024-10-09 21:23:06 -04:00
|
|
|
record.errors.add(attribute, :blank) if value.blank?
|
2016-03-03 13:01:31 -05:00
|
|
|
end
|
2013-12-19 15:12:03 -05:00
|
|
|
end
|