Sha256: a5e4a3190a9300dbc7f36cd10fb2fefe7ebf06e214543abfa91a82cb51e4f599

Contents?: true

Size: 361 Bytes

Versions: 43

Compression:

Stored size: 361 Bytes

Contents

ActiveRecord::Base.transaction do
  Spree::Country.all.each do |country|
    carmen_country = Carmen::Country.coded(country.iso)
    next unless carmen_country.subregions?

    carmen_country.subregions.each do |subregion|
      Spree::State.where(abbr: subregion.code, country: country).first_or_create!(
        name: subregion.name
      )
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
solidus_core-2.5.2 db/default/spree/states.rb
solidus_core-2.5.1 db/default/spree/states.rb
solidus_core-2.5.0 db/default/spree/states.rb
solidus_core-2.5.0.rc1 db/default/spree/states.rb
solidus_core-2.5.0.beta2 db/default/spree/states.rb
solidus_core-2.5.0.beta1 db/default/spree/states.rb
solidus_core-2.4.2 db/default/spree/states.rb
solidus_core-2.3.1 db/default/spree/states.rb
solidus_core-2.4.1 db/default/spree/states.rb
solidus_core-2.2.2 db/default/spree/states.rb
solidus_core-2.1.1 db/default/spree/states.rb
solidus_core-2.0.3 db/default/spree/states.rb
solidus_core-1.4.2 db/default/spree/states.rb
solidus_core-1.3.2 db/default/spree/states.rb
solidus_core-2.4.0 db/default/spree/states.rb
solidus_core-2.4.0.rc1 db/default/spree/states.rb
solidus_core-2.4.0.beta1 db/default/spree/states.rb
solidus_core-2.3.0 db/default/spree/states.rb
solidus_core-2.3.0.rc3 db/default/spree/states.rb
solidus_core-2.3.0.rc2 db/default/spree/states.rb