Created
June 13, 2012 18:37
-
-
Save jbourassa/2925711 to your computer and use it in GitHub Desktop.
Add provinces to Spree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
canada = Spree::Country.find_by_iso('CA') | |
Spree::State.delete_all country_id: canada.id | |
provinces = [ | |
{ name: "Québec", abbr: "QC" }, | |
{ name: "Ontario", abbr: "ON" }, | |
{ name: "British Columbia", abbr: "BC" }, | |
{ name: "Alberta", abbr: "AB" }, | |
{ name: "Manitoba", abbr: "MB" }, | |
{ name: "Saskatchewan", abbr: "SK" }, | |
{ name: "Nova Scotia", abbr: "NS" }, | |
{ name: "New Brunswick", abbr: "NB" }, | |
{ name: "Newfoundland and Labrador", abbr: "NL" }, | |
{ name: "Prince Edward Island", abbr: "PE" }, | |
{ name: "Northwest Territories", abbr: "NT" }, | |
{ name: "Yukon", abbr: "YT" }, | |
{ name: "Nunavut", abbr: "NY" }, | |
] | |
provinces.each do |province| | |
state = Spree::State.new province | |
state.country = canada | |
state.save! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment