mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
24 lines
685 B
Ruby
24 lines
685 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PreferencesHelper
|
|
# Resets all preferences to default values, you can
|
|
# pass a block to override the defaults with a block
|
|
#
|
|
# reset_spree_preferences do |config|
|
|
# config.site_name = "my fancy pants store"
|
|
# end
|
|
#
|
|
def reset_spree_preferences(&config_block)
|
|
Spree::Preferences::Store.instance.persistence = false
|
|
Spree::Preferences::Store.instance.clear_cache
|
|
|
|
config = Rails.application.config.spree.preferences
|
|
configure_spree_preferences(&config_block) if block_given?
|
|
end
|
|
|
|
def configure_spree_preferences
|
|
config = Rails.application.config.spree.preferences
|
|
yield(config) if block_given?
|
|
end
|
|
end
|