Sha256: c51485ce9073ffb5f5f4b3d0224e99d1bd7a4f5507dc5552bd3479881ffa8d49
Contents?: true
Size: 759 Bytes
Versions: 4
Compression:
Stored size: 759 Bytes
Contents
module SportDB::Models class Country < ActiveRecord::Base self.table_name = 'countries' 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' 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 # class Country end # module Models::SportDB
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sportdb-0.6.0 | lib/sportdb/models/country.rb |
sportdb-0.5.6 | lib/sportdb/models/country.rb |
sportdb-0.5.5 | lib/sportdb/models/country.rb |
sportdb-0.5.4 | lib/sportdb/models/country.rb |