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



19
20
21
# File 'lib/spree/preferences/statically_configurable.rb', line 19

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

#preferencesObject



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

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

#preferences=(val) ⇒ Object



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

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