Class: SportDb::Model::Assoc

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/sportdb/models/models/forward.rb,
lib/sportdb/models/models/assoc.rb

Overview

note: for now only team and league use worlddb tables

e.g. with belongs_to assoc (country,region)

Instance Method Summary collapse

Instance Method Details

#all_assocsObject

note: split member_assocs into two sets (into national=true and national=false) e.g. fifa has six member confederations (non-national) and 216 national assocs note: includes all member (sub assocs + national assocs) - rename to member_assocs?



15
# File 'lib/sportdb/models/models/assoc.rb', line 15

has_many :all_assocs, class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs

#member_assoc_assocsObject

child_assocs - use child_assocs? - (direct) member/child assocs instead of member?



9
# File 'lib/sportdb/models/models/assoc.rb', line 9

has_many :member_assoc_assocs,  class_name: 'AssocAssoc', foreign_key: 'assoc1_id'

#parent_assocsObject

for now can have more than one (direct) parent assoc

e.g. Africa Fed and Arab League Fed


22
# File 'lib/sportdb/models/models/assoc.rb', line 22

has_many :parent_assocs, class_name: 'Assoc', :source => :assoc1, :through => :parent_assoc_assocs

#sub_assocsObject

use zone/region as name instead of sub ( for confederatons,zones,etc.)



17
# File 'lib/sportdb/models/models/assoc.rb', line 17

has_many :sub_assocs,      -> { where( national: false ) },  class_name: 'Assoc', :source => :assoc2, :through => :member_assoc_assocs