mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-06 15:41:09 -05:00
6 lines
219 B
Ruby
6 lines
219 B
Ruby
class ApprovedValidator < ActiveModel::EachValidator
|
|
def validate_each(record, attribute, _value)
|
|
record.errors[attribute] << (options[:message] || 'must be approved') unless record.crop.try(:approved?)
|
|
end
|
|
end
|