Sha256: ee9f496066f63a8d70dde2606d9ce25a3827de47f984bfd6279714df7ddfbf50

Contents?: true

Size: 571 Bytes

Versions: 11

Compression:

Stored size: 571 Bytes

Contents

module SportDb
  module Model


class Group < ActiveRecord::Base

if ActiveRecord::VERSION::MAJOR == 3
  has_many :games, :order => 'pos'
else
  has_many :games, -> { order('pos') }
end

  belongs_to :event
  
  has_many :group_teams, :class_name => 'GroupTeam'
  has_many :teams, :through => :group_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 Group
  
  
  end # module Model
end # module SportDb

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sportdb-1.8.28 lib/sportdb/models/group.rb
sportdb-1.8.27 lib/sportdb/models/group.rb
sportdb-1.8.26 lib/sportdb/models/group.rb
sportdb-1.8.25 lib/sportdb/models/group.rb
sportdb-1.8.24 lib/sportdb/models/group.rb
sportdb-1.8.23 lib/sportdb/models/group.rb
sportdb-1.8.22 lib/sportdb/models/group.rb
sportdb-1.8.21 lib/sportdb/models/group.rb
sportdb-1.8.20 lib/sportdb/models/group.rb
sportdb-1.8.19 lib/sportdb/models/group.rb
sportdb-1.8.18 lib/sportdb/models/group.rb