Sha256: dd3c56e0d3cea8e4558e07179da0176b26ef98d515dae7f7cde2cce46d27f73f

Contents?: true

Size: 392 Bytes

Versions: 48

Compression:

Stored size: 392 Bytes

Contents

# frozen_string_literal: true

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

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 db/default/spree/states.rb
solidus_core-2.10.3 db/default/spree/states.rb
solidus_core-2.10.2 db/default/spree/states.rb
solidus_core-2.9.6 db/default/spree/states.rb
solidus_core-2.8.6 db/default/spree/states.rb
solidus_core-2.10.1 db/default/spree/states.rb
solidus_core-2.9.5 db/default/spree/states.rb
solidus_core-2.10.0 db/default/spree/states.rb
solidus_core-2.9.4 db/default/spree/states.rb
solidus_core-2.6.6 db/default/spree/states.rb
solidus_core-2.7.4 db/default/spree/states.rb
solidus_core-2.8.5 db/default/spree/states.rb
solidus_core-2.9.3 db/default/spree/states.rb
solidus_core-2.9.2 db/default/spree/states.rb
solidus_core-2.10.0.beta1 db/default/spree/states.rb
solidus_core-2.7.3 db/default/spree/states.rb
solidus_core-2.6.5 db/default/spree/states.rb
solidus_core-2.9.1 db/default/spree/states.rb
solidus_core-2.9.0 db/default/spree/states.rb
solidus_core-2.9.0.rc.1 db/default/spree/states.rb