lib/sportdb/models/country.rb in sportdb-0.6.0 vs lib/sportdb/models/country.rb in sportdb-0.7.0
- old
+ new
@@ -1,29 +1,18 @@
-module SportDB::Models
+# encoding: utf-8
+## todo: how to best extends country model?
-class Country < ActiveRecord::Base
- self.table_name = 'countries'
+module WorldDB::Models
- has_many :regions, :class_name => 'Region', :foreign_key => 'country_id'
- has_many :cities, :class_name => 'City', :foreign_key => 'country_id'
- has_many :teams, :class_name => 'Team', :foreign_key => 'country_id'
- has_many :leagues, :class_name => 'League', :foreign_key => 'country_id'
+ class Country
+ has_many :teams, :class_name => 'Team', :foreign_key => 'country_id'
+ has_many :leagues, :class_name => 'League', :foreign_key => 'country_id'
+ end # class Country
- def self.create_from_ary!( countries )
- countries.each do |values|
-
- ## key & title required
- attr = {
- :key => values[0],
- :title => values[1],
- :tag => values[2]
- }
-
- Country.create!( attr )
- end # each country
- end
+end # module WorldDB::Models
-end # class Country
-
-end # module Models::SportDB
+## moved to models/forward
+# module SportDB::Models
+# Country = WorldDB::Models::Country
+# end # module SportDB::Models