Sha256: 2dff5bbe8e0c8427159bc50d38029c468076a65fd19c8fe1e7caaf9ea4397b2d

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

module SportDB::Models

class Event < ActiveRecord::Base
  
  has_many :rounds, :order => 'pos'  # all (fix and flex) rounds
  
  has_many :groups, :order => 'pos'
  
  has_many :event_teams, :class_name => 'EventTeam'
  has_many :teams, :through => :event_teams

  def add_teams_from_ary!( team_keys )
    team_keys.each do |team_key|
      team = Team.find_by_key!( team_key )
      self.teams << team
    end
  end

end # class Event

end # module SportDB::Models

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sportdb-0.4.5 lib/sportdb/models/event.rb
sportdb-0.4.4 lib/sportdb/models/event.rb
sportdb-0.4.3 lib/sportdb/models/event.rb