sportdb 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,9 @@ class City < ActiveRecord::Base
4
4
  self.table_name = 'cities'
5
5
 
6
6
  belongs_to :country, :class_name => 'Country', :foreign_key => 'country_id'
7
+
8
+ has_many :teams, :class_name => 'Team', :foreign_key => 'city_id'
9
+
7
10
 
8
11
  def self.create_from_ary!( cities, more_values={} )
9
12
  cities.each do |values|
@@ -3,8 +3,9 @@ module SportDB::Models
3
3
 
4
4
  class Country < ActiveRecord::Base
5
5
  self.table_name = 'countries'
6
-
7
- has_many :cities, :class_name => 'City', :foreign_key => 'city_id'
6
+
7
+ has_many :cities, :class_name => 'City', :foreign_key => 'country_id'
8
+ has_many :teams, :class_name => 'Team', :foreign_key => 'country_id'
8
9
 
9
10
  def self.create_from_ary!( countries )
10
11
  countries.each do |values|
@@ -5,6 +5,11 @@ class Team < ActiveRecord::Base
5
5
 
6
6
  has_many :home_games, :class_name => 'Game', :foreign_key => 'team1_id'
7
7
  has_many :away_games, :class_name => 'Game', :foreign_key => 'team2_id'
8
+
9
+ ### fix - how to do it with has_many macro? possible??
10
+ def games
11
+ Game.where( 'team1_id = ? or team2_id = ?', id, id ).order( 'play_at' ).all
12
+ end
8
13
 
9
14
  has_many :badges # Winner, 2nd, Cupsieger, Aufsteiger, Absteiger, etc.
10
15
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module SportDB
3
- VERSION = '0.5.1'
3
+ VERSION = '0.5.2'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gerald Bauer