Module: Spree::Preferences::StaticallyConfigurable

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) preference_source=(val)

override assignment to cast empty string to nil



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

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

- (Object) preferences



21
22
23
24
25
26
27
# File 'app/models/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

- (Object) preferences=(val)



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

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