class MatchValidation::Validator::ValidateChangeMatch

Class to validate changes to a match after play has started. The match opponents may not be changed, for example.

Public Class Methods

new(match) click to toggle source
# File app/models/concerns/match_validation.rb, line 130
def initialize(match)
  @match = match
end

Public Instance Methods

validate(errors) click to toggle source

Check for invalid changes to the match. Add error messages to a hash.

  • Args

    • errors -> hash

# File app/models/concerns/match_validation.rb, line 137
def validate(errors)
  find_invalid_changes do |sym|
    errors.add sym, 'can\t be changed after match has started'
  end
end