sportdb-models 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,31 @@
1
- # encoding: utf-8
2
-
3
- module SportDb
4
- module Model
5
-
6
-
7
- class EventStanding < ActiveRecord::Base
8
-
9
- self.table_name = 'event_standings'
10
-
11
- has_many :entries, class_name: 'SportDb::Model::EventStandingEntry', foreign_key: 'event_standing_id', :dependent => :delete_all
12
- belongs_to :event
13
-
14
- end # class EventStanding
15
-
16
-
17
- class EventStandingEntry < ActiveRecord::Base
18
-
19
- self.table_name = 'event_standing_entries'
20
-
21
- belongs_to :standing, class_name: 'SportDb::Model::EventStanding', foreign_key: 'event_standing_id'
22
- belongs_to :team
23
-
24
- ## note:
25
- ## map standing_id to group_standing_id - convenience alias
26
- def standing_id=(value) write_attribute(:event_standing_id, value); end
27
-
28
- end # class EventStandingEntry
29
-
30
- end # module Model
31
- end # module SportDb
1
+ # encoding: utf-8
2
+
3
+ module SportDb
4
+ module Model
5
+
6
+
7
+ class EventStanding < ActiveRecord::Base
8
+
9
+ self.table_name = 'event_standings'
10
+
11
+ has_many :entries, class_name: 'SportDb::Model::EventStandingEntry', foreign_key: 'event_standing_id', :dependent => :delete_all
12
+ belongs_to :event
13
+
14
+ end # class EventStanding
15
+
16
+
17
+ class EventStandingEntry < ActiveRecord::Base
18
+
19
+ self.table_name = 'event_standing_entries'
20
+
21
+ belongs_to :standing, class_name: 'SportDb::Model::EventStanding', foreign_key: 'event_standing_id'
22
+ belongs_to :team
23
+
24
+ ## note:
25
+ ## map standing_id to group_standing_id - convenience alias
26
+ def standing_id=(value) write_attribute(:event_standing_id, value); end
27
+
28
+ end # class EventStandingEntry
29
+
30
+ end # module Model
31
+ end # module SportDb
@@ -16,8 +16,9 @@ class Team < ActiveRecord::Base
16
16
  has_many :home_matches, class_name: 'Match', foreign_key: 'team1_id'
17
17
  has_many :away_matches, class_name: 'Match', foreign_key: 'team2_id'
18
18
 
19
- validates :key, format: { with: TEAM_KEY_RE, message: TEAM_KEY_MESSAGE }
20
- validates :code, format: { with: TEAM_CODE_RE, message: TEAM_CODE_MESSAGE }, allow_nil: true
19
+ ## note: for now allow any key and code
20
+ ## validates :key, format: { with: TEAM_KEY_RE, message: TEAM_KEY_MESSAGE }
21
+ ## validates :code, format: { with: TEAM_CODE_RE, message: TEAM_CODE_MESSAGE }, allow_nil: true
21
22
 
22
23
  has_many :event_teams, class_name: 'EventTeam' # join table (events+teams)
23
24
  has_many :events, :through => :event_teams
@@ -1,20 +1,20 @@
1
- # encoding: utf-8
2
-
3
- module WorldDb
4
- module Model
5
-
6
- class Continent
7
- has_many :teams, :through => :countries
8
-
9
- # fix: require active record 4
10
- # has_many :clubs, :through => :countries
11
- # has_many :national_teams, :through => :countries
12
-
13
-
14
- has_many :leagues, :through => :countries
15
- has_many :grounds, :through => :countries
16
- end # class Continent
17
-
18
- end # module Model
19
- end # module WorldDb
20
-
1
+ # encoding: utf-8
2
+
3
+ module WorldDb
4
+ module Model
5
+
6
+ class Continent
7
+ has_many :teams, :through => :countries
8
+
9
+ # fix: require active record 4
10
+ # has_many :clubs, :through => :countries
11
+ # has_many :national_teams, :through => :countries
12
+
13
+
14
+ has_many :leagues, :through => :countries
15
+ has_many :grounds, :through => :countries
16
+ end # class Continent
17
+
18
+ end # module Model
19
+ end # module WorldDb
20
+
@@ -1,19 +1,19 @@
1
- # encoding: utf-8
2
-
3
-
4
- module WorldDb
5
- module Model
6
-
7
- class State
8
- has_many :teams, class_name: 'SportDb::Model::Team', :through => :cities
9
-
10
- # fix: require active record 4
11
- # has_many :clubs, class_name: 'SportDb::Model::Team', :through => :cities
12
- # has_many :national_teams, class_name: 'SportDb::Model::Team', :through => :cities
13
-
14
- has_many :grounds, class_name: 'SportDb::Model::Ground', :through => :cities
15
- end # class State
16
-
17
- end # module Model
18
- end # module WorldDb
19
-
1
+ # encoding: utf-8
2
+
3
+
4
+ module WorldDb
5
+ module Model
6
+
7
+ class State
8
+ has_many :teams, class_name: 'SportDb::Model::Team', :through => :cities
9
+
10
+ # fix: require active record 4
11
+ # has_many :clubs, class_name: 'SportDb::Model::Team', :through => :cities
12
+ # has_many :national_teams, class_name: 'SportDb::Model::Team', :through => :cities
13
+
14
+ has_many :grounds, class_name: 'SportDb::Model::Ground', :through => :cities
15
+ end # class State
16
+
17
+ end # module Model
18
+ end # module WorldDb
19
+