Class: Spree::OptionType

Inherits:
Object
  • Object
show all
Includes:
Metadata, Metafields, ParameterizableName, TranslatableResource, UniqueName, Webhooks::HasWebhooks
Defined in:
app/models/spree/option_type.rb

Constant Summary collapse

COLOR_NAMES =
%w[color colour].freeze
TRANSLATABLE_FIELDS =
i[presentation].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.colorObject



69
70
71
# File 'app/models/spree/option_type.rb', line 69

def self.color
  colors.first
end

Instance Method Details

#color?Boolean

Returns:



73
74
75
# File 'app/models/spree/option_type.rb', line 73

def color?
  name.in?(COLOR_NAMES)
end

#filter_paramObject

legacy, name itself is now parameterized before saving



64
65
66
67
# File 'app/models/spree/option_type.rb', line 64

def filter_param
  Spree::Deprecation.warn('Spree::OptionType#filter_param is deprecated and will be removed in Spree 6. Please use Spree::OptionType#name instead.')
  name.parameterize
end