From d4cf44a6dd09eac9b66bcae448abefd9d02ac2a8 Mon Sep 17 00:00:00 2001 From: Paul Mackay Date: Sun, 29 Mar 2015 17:06:05 +0100 Subject: [PATCH] Use COUNTRY_CODE instead of COUNTRY in application.yml. --- config/application.yml.example | 2 +- config/initializers/spree.rb | 2 +- ...50936_add_address_instances_to_existing_enterprise_groups.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/application.yml.example b/config/application.yml.example index f953cb4601..9eba8eb6ee 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -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. diff --git a/config/initializers/spree.rb b/config/initializers/spree.rb index a28763f289..a6a045222d 100644 --- a/config/initializers/spree.rb +++ b/config/initializers/spree.rb @@ -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 diff --git a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb b/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb index 23fc038ce8..3b93ee6386 100644 --- a/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb +++ b/db/migrate/20150115050936_add_address_instances_to_existing_enterprise_groups.rb @@ -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?