Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

11 lines (9 sloc) 0.274 kB
class RatingValidator < ActiveModel::Validator
def validate(record)
record.errors[:base] << "That's not a valid rating" unless check(record)
end
private
def check(record)
(record.rating == -1) || (record.rating == 0) || (record.rating == 1)
end
end
Jump to Line
Something went wrong with that request. Please try again.