class AuthorValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/winewoo_core/models/author_validator.rb, line 3 def validate_each(record, attribute, value) if record.vintage if record.vintage.user_comments.find_by(winewoo_user_id: value) record.errors[:user] = 'has already posted a comment.' return false end end return true end