Sha256: 46ca8a4beb6e611df7fb30f14aa453724c4242b3f6e70a11b4efd6491333e626

Contents?: true

Size: 338 Bytes

Versions: 55

Compression:

Stored size: 338 Bytes

Contents

Spree::Country.where(states_required: true).each do |country|
  carmen_country = Carmen::Country.named(country.name)
  next unless carmen_country

  carmen_country.subregions.each do |subregion|
    country.states.where(
      name: subregion.name,
      abbr: subregion.code,
      country_id: country.id
    ).first_or_create
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
spree_core-4.1.9 db/default/spree/states.rb
spree_core-4.1.8 db/default/spree/states.rb
spree_core-4.1.7 db/default/spree/states.rb
spree_core-4.1.6 db/default/spree/states.rb
spree_core-4.1.5 db/default/spree/states.rb
spree_core-4.1.4 db/default/spree/states.rb
spree_core-4.1.3 db/default/spree/states.rb
spree_core-4.1.2 db/default/spree/states.rb
spree_core-4.1.1 db/default/spree/states.rb
spree_core-4.1.0 db/default/spree/states.rb
spree_core-4.1.0.rc3 db/default/spree/states.rb
spree_core-4.1.0.rc2 db/default/spree/states.rb
spree_core-4.1.0.rc1 db/default/spree/states.rb
spree_core-3.7.10 db/default/spree/states.rb
spree_core-4.0.3 db/default/spree/states.rb
spree_core-3.7.9 db/default/spree/states.rb
spree_core-4.0.2 db/default/spree/states.rb
spree_core-3.7.8 db/default/spree/states.rb
spree_core-4.0.1 db/default/spree/states.rb
spree_core-3.7.7 db/default/spree/states.rb