Files
openfoodnetwork/config/initializers/spree.rb
Maikel Linke ff4bd449a2 Setting default_country_id by application.yml
The spree default_country_id was set using ENV["DEFAULT_COUNTRY"] for
production environment, but not for tests and development. Since tests
reset the default_country_id in specs/support/seeds.rb, only the
development environment had a fix id set to 12. This is removed now.

This fixes creating enterprises and enterprise groups without sample
data (12 is Australia).
2015-02-26 16:29:46 +11:00

55 lines
1.6 KiB
Ruby

# Configure Spree Preferences
#
# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
# If you would like users to be able to update a setting with the Admin it should NOT be set here.
#
# In order to initialize a setting do:
# config.setting_name = 'new value'
require 'spree/product_filters'
Spree.config do |config|
config.shipping_instructions = true
config.checkout_zone = ENV["CHECKOUT_ZONE"]
config.address_requires_state = true
country = Spree::Country.find_by_name(ENV["DEFAULT_COUNTRY"])
config.default_country_id = country.id if country.present?
# -- spree_paypal_express
# Auto-capture payments. Without this option, payments must be manually captured in the paypal interface.
config.auto_capture = true
#config.override_actionmailer_config = false
end
# TODO Work out why this is necessary
# Seems like classes within OFN module become 'uninitialized' when server reloads
# unless the empty module is explicity 'registered' here. Something to do with autoloading?
module OpenFoodNetwork
end
# Add calculators category for enterprise fees
module Spree
module Core
class Environment
class Calculators
include EnvironmentExtension
attr_accessor :enterprise_fees
end
end
end
end
# Forcing spree to always allow SSL connections
# Since we are using config.force_ssl = true
# Without this we get a redirect loop: see https://groups.google.com/forum/#!topic/spree-user/NwpqGxJ4klk
SslRequirement.module_eval do
protected
def ssl_allowed?
true
end
end