Class: ThrowawayValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ThrowawayValidator
- Defined in:
- lib/throwaway/throwaway_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/throwaway/throwaway_validator.rb', line 4 def validate_each(record, attribute, value) result = Throwaway.is_throwaway?(value) record.errors[attribute] << ([:message] || "is not from a disposable email provider.") if [:with].nil? and !result record.errors[attribute] << ([:message] || "is from a disposable email provider.") if ![:with].nil? and result end |