Sha256: 7137c5ff00b4c962b5c14ba611fff09307e851b02d5c560f29487cc0ca5a63aa

Contents?: true

Size: 826 Bytes

Versions: 14

Compression:

Stored size: 826 Bytes

Contents

module Spree
  # Singleton class to access the configuration object (AppConfiguration.first by default) and it's preferences.
  #
  # Usage:
  #   Spree::Config[:foo]                  # Returns the +foo+ preference
  #   Spree::Config[]                      # Returns a Hash with all the application preferences
  #   Spree::Config.intance                # Returns the configuration object (AppConfiguration.first)
  #   Spree::Config.set(preferences_hash)  # Set the application preferences as especified in +preference_hash+
  class Config
    include Singleton
    include PreferenceAccess
    
    class << self
      def instance
        return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
        AppConfiguration.find_or_create_by_name("Default configuration")
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
kdmny-spree-0.0.1 lib/spree/config.rb
spree-0.8.4 lib/spree/config.rb
spree-0.8.5 lib/spree/config.rb
spree-0.4.0 lib/spree/config.rb
spree-0.4.1 lib/spree/config.rb
spree-0.5.0 lib/spree/config.rb
spree-0.6.0 lib/spree/config.rb
spree-0.5.1 lib/spree/config.rb
spree-0.7.0 lib/spree/config.rb
spree-0.7.1 lib/spree/config.rb
spree-0.8.0 lib/spree/config.rb
spree-0.8.1 lib/spree/config.rb
spree-0.8.2 lib/spree/config.rb
spree-0.8.3 lib/spree/config.rb