Class: TanoshimuUtils::Validators::PresenceOneOf::AnyPresenceValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- TanoshimuUtils::Validators::PresenceOneOf::AnyPresenceValidator
- Defined in:
- lib/tanoshimu_utils/validators/presence_one_of.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
7 8 9 10 11 |
# File 'lib/tanoshimu_utils/validators/presence_one_of.rb', line 7 def validate(record) unless [:fields].any?{|attr| record[attr].present?} record.errors.add(:title, 'must be present (at lease one of en, fr, or jp)') end end |