Use COUNTRY_CODE instead of COUNTRY in application.yml.

This commit is contained in:
Paul Mackay
2015-03-29 17:06:05 +01:00
parent 6e77a5eebc
commit d4cf44a6dd
3 changed files with 3 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ SECRET_TOKEN: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TIMEZONE: Melbourne
# Default country for dropdowns etc.
DEFAULT_COUNTRY: Australia
DEFAULT_COUNTRY_CODE: AU
# Locale for translation.
LOCALE: en
# Spree zone.

View File

@@ -17,7 +17,7 @@ Spree.config do |config|
config.checkout_zone = ENV["CHECKOUT_ZONE"]
config.currency = ENV['CURRENCY']
if Spree::Country.table_exists?
country = Spree::Country.find_by_name(ENV["DEFAULT_COUNTRY"])
country = Spree::Country.find_by_iso(ENV['DEFAULT_COUNTRY_CODE'])
config.default_country_id = country.id if country.present?
else
config.default_country_id = 12 # Australia

View File

@@ -1,6 +1,6 @@
class AddAddressInstancesToExistingEnterpriseGroups < ActiveRecord::Migration
def change
country = Spree::Country.find_by_name(ENV['DEFAULT_COUNTRY'])
country = Spree::Country.find_by_iso(ENV['DEFAULT_COUNTRY_CODE'])
state = country.states.first
EnterpriseGroup.all.each do |g|
next if g.address.present?