Class: Spree::Editor::Config

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

Overview

Singleton class to access the advanced cart configuration object (EditorConfiguration.first by default) and it’s preferences.

Usage: Spree::Editor::Config # Returns the foo preference Spree::Editor::Config[] # Returns a Hash with all the google base preferences Spree::Editor::Config.instance # Returns the configuration object (EditorConfiguration.first) Spree::Editor::Config.set(preferences_hash) # Set the advanced cart preferences as especified in preference_hash

Class Method Summary collapse

Class Method Details

.instanceObject



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

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