Module: Spree::Preferences::StaticallyConfigurable

Extended by:
ActiveSupport::Concern
Included in:
Spree::PaymentMethod
Defined in:
lib/spree/preferences/statically_configurable.rb

Instance Method Summary collapse

Instance Method Details

#preference_source=(val) ⇒ Object

override assignment to cast empty string to nil



17
18
19
# File 'lib/spree/preferences/statically_configurable.rb', line 17

def preference_source=(val)
  super(val.presence)
end

#preferencesObject



21
22
23
24
25
26
27
# File 'lib/spree/preferences/statically_configurable.rb', line 21

def preferences
  if respond_to?(:preference_source) && preference_source
    self.class.preference_sources[preference_source] || {}
  else
    self[:preferences]
  end
end

#preferences=(val) ⇒ Object



29
30
31
32
33
34
# File 'lib/spree/preferences/statically_configurable.rb', line 29

def preferences=(val)
  if respond_to?(:preference_source) && preference_source
  else
    self[:preferences] = val
  end
end