Class: Spree::OptionValue
- Inherits:
-
Object
- Object
- Spree::OptionValue
- Includes:
- Metadata, Metafields, ParameterizableName, TranslatableResource, Webhooks::HasWebhooks
- Defined in:
- app/models/spree/option_value.rb
Constant Summary collapse
- TRANSLATABLE_FIELDS =
i[presentation].freeze
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.
Class Method Details
.to_tom_select_json ⇒ Array<Hash>
Using map here instead of pluck, as these values are translatable via Mobility gem
65 66 67 68 69 70 71 72 |
# File 'app/models/spree/option_value.rb', line 65 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”
76 77 78 |
# File 'app/models/spree/option_value.rb', line 76 def display_presentation @display_presentation ||= "#{option_type.presentation}: #{presentation}" end |