mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-25 02:05:10 -04:00
6 lines
218 B
Ruby
6 lines
218 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
|