mirror of
https://github.com/iritmaximus/brewery.git
synced 2026-10-12 19:13:49 +03:00
13 lines
308 B
Ruby
13 lines
308 B
Ruby
class Rating < ApplicationRecord
|
|
belongs_to :beer
|
|
belongs_to :user
|
|
|
|
validates :score, numericality: { greater_than_or_equal_to: 1,
|
|
less_than_or_equal_to: 50,
|
|
only_integer: true }
|
|
|
|
def to_s
|
|
"#{beer.name}: #{score}"
|
|
end
|
|
end
|