Class: Spree::Auth::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton, PreferenceAccess
Defined in:
lib/spree/auth/config.rb

Overview

Singleton class to access the shipping configuration object (ActiveShippingConfiguration.first by default) and it’s preferences.

Usage:

Spree::Auth::Config[:foo]                  # Returns the foo preference
Spree::Auth::Config[]                      # Returns a Hash with all the tax preferences
Spree::Auth::Config.instance               # Returns the configuration object (AuthConfiguration.first)
Spree::Auth::Config.set(preferences_hash)  # Set the spree auth preferences as especified in +preference_hash+

Class Method Summary collapse

Class Method Details

.instanceObject



15
16
17
18
# File 'lib/spree/auth/config.rb', line 15

def instance
  return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
  SpreeAuthConfiguration.find_or_create_by_name("Default spree_auth configuration")
end