hpi-swt2/sport-portal

View on GitHub
app/models/game_result.rb

Summary

Maintainability
A
0 mins
Test Coverage
# == Schema Information
#
# Table name: game_results
#
#  id         :integer          not null, primary key
#  score_home :integer
#  score_away :integer
#  match_id   :integer
#  created_at :datetime         not null
#  updated_at :datetime         not null
#

class GameResult < ApplicationRecord
  belongs_to :match

  validates :score_home, :score_away, numericality: { only_integer: true, greather_than_or_equal_to: 0 }, allow_nil: true
end