Sha256: fa115b0dd8ce800b25cf2fff487e8c41727d4862cf083bc072b3d80ec94975b5
Contents?: true
Size: 960 Bytes
Versions: 1
Compression:
Stored size: 960 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 :games, :through => :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 ########################### ## convenience helpers def self.find_at_2012_13! self.find_by_key!( 'at.2012/13' ) end def self.find_at_cup_2012_13! self.find_by_key!( 'at.cup.2012/13' ) end def self.find_cl_2012_13! self.find_by_key!( 'cl.2012/13' ) end def self.find_euro_2012! self.find_by_key!( 'euro.2012') end end # class Event end # module SportDB::Models
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sportdb-0.8.1 | lib/sportdb/models/event.rb |