11 行
395 B
Ruby
11 行
395 B
Ruby
class GekanatorGame < ApplicationRecord
|
|
belongs_to :user, optional: true
|
|
belongs_to :guessed_post, class_name: 'Post'
|
|
belongs_to :correct_post, class_name: 'Post', optional: true
|
|
|
|
validates :answers, presence: true
|
|
validates :correct_post, presence: true
|
|
validates :question_count, numericality: { greater_than_or_equal_to: 0 }
|
|
validates :won, inclusion: { in: [true, false] }
|
|
end
|