Skip to content

Commit

Permalink
Make zone members creation idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
jontarg authored Jan 10, 2019
1 parent b1e1bbf commit 22c11d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/db/default/spree/zones.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG GB LT CY LU MT DK NL EE HR CZ GR).
each do |symbol|
eu_vat.zone_members.create!(zoneable: Spree::Country.find_by!(iso: symbol))
eu_vat.zone_members.find_or_create_by!(zoneable: Spree::Country.find_by!(iso: symbol))
end

%w(US CA).each do |symbol|
north_america.zone_members.create!(zoneable: Spree::Country.find_by!(iso: symbol))
north_america.zone_members.find_or_create_by!(zoneable: Spree::Country.find_by!(iso: symbol))
end

0 comments on commit 22c11d9

Please sign in to comment.