Sha256: e019221cc9edb7b9d3607eaca376f098e2be707d26f95b38ff2abbc1e561d3b7
Contents?: true
Size: 532 Bytes
Versions: 88
Compression:
Stored size: 532 Bytes
Contents
require "countries" class PopulateCountriesAndStates < ActiveRecord::Migration def change ISO3166::Country.all.each do |country_array| name = country_array[0] abbr = country_array[1] country = Piggybak::Country.create :name => name, :abbr => abbr iso3166_country = ISO3166::Country.new(abbr) iso3166_country.states.each do |key, value| abbr = key name = value["name"] Piggybak::State.create! :name => name, :abbr => abbr, :country => country end end end end
Version data entries
88 entries across 88 versions & 1 rubygems