Class: Spree::OptionType

Inherits:
Object
  • Object
show all
Includes:
Metadata, Metafields, ParameterizableName, TranslatableResource, UniqueName
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



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

def self.color
  colors.first
end

Instance Method Details

#color?Boolean

Returns:



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

def color?
  name.in?(COLOR_NAMES)
end

#filter_paramObject

legacy, name itself is now parameterized before saving



61
62
63
64
# File 'app/models/spree/option_type.rb', line 61

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