Class: Spree::OptionValue
- Inherits:
-
Object
- Object
- Spree::OptionValue
- Includes:
- Metadata, Metafields, ParameterizableName, PresentationTranslatable
- Defined in:
- app/models/spree/option_value.rb
Constant Summary collapse
- TRANSLATABLE_FIELDS =
Spree::PresentationTranslatable::TRANSLATABLE_FIELDS
Class Method Summary collapse
-
.to_tom_select_json ⇒ Array<Hash>
Using map here instead of pluck, as these values are translatable via Mobility gem.
Instance Method Summary collapse
-
#display_presentation ⇒ String
Returns the presentation with the option type presentation, eg.
Methods included from PresentationTranslatable
Methods included from TranslatableResource
#get_field_with_locale, #translatable_store, #upsert_translations
Methods included from Metadata
#metadata, #metadata=, #public_metadata=
Class Method Details
.to_tom_select_json ⇒ Array<Hash>
Using map here instead of pluck, as these values are translatable via Mobility gem
71 72 73 74 75 76 77 78 |
# File 'app/models/spree/option_value.rb', line 71 def self.to_tom_select_json all.map do |ov| { id: ov.name, name: ov.presentation } end end |
Instance Method Details
#display_presentation ⇒ String
Returns the presentation with the option type presentation, eg. "Color: Red"
82 83 84 |
# File 'app/models/spree/option_value.rb', line 82 def display_presentation @display_presentation ||= "#{option_type.presentation}: #{presentation}" end |