Sha256: 300974254d9d2ac17e42002092a6c42fd2c210fd6237ea4271d26647a0931897

Contents?: true

Size: 534 Bytes

Versions: 4

Compression:

Stored size: 534 Bytes

Contents

module SportDB::Models

class Event < ActiveRecord::Base
  
  belongs_to :league
  belongs_to :season
  
  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

4 entries across 4 versions & 1 rubygems

Version Path
sportdb-0.5.3 lib/sportdb/models/event.rb
sportdb-0.5.2 lib/sportdb/models/event.rb
sportdb-0.5.1 lib/sportdb/models/event.rb
sportdb-0.5.0 lib/sportdb/models/event.rb