Class: Spree::OptionValue
- Inherits:
-
Object
- Object
- Spree::OptionValue
- Includes:
- HasCustomFields, LabelTranslatable, Metadata, ParameterizableName
- Defined in:
- app/models/spree/option_value.rb
Constant Summary collapse
- TRANSLATABLE_FIELDS =
Spree::LabelTranslatable::TRANSLATABLE_FIELDS
Class Method Summary collapse
-
.to_tom_select_json ⇒ Array<Hash>
deprecated
Deprecated.
Legacy Tom Select helper for the removed Rails admin. No replacement.
-
.translation_write_permission ⇒ Object
Values are written through their option type, so they ride the same permission.
Instance Method Summary collapse
-
#display_presentation ⇒ String
deprecated
Deprecated.
No replacement, build the label in the presentation layer instead.
Methods included from LabelTranslatable
Methods included from TranslatableResource
#get_field_with_locale, #translatable_store, #upsert_translations
Methods included from Metadata
#private_metadata, #private_metadata=
Class Method Details
.to_tom_select_json ⇒ Array<Hash>
Deprecated.
Legacy Tom Select helper for the removed Rails admin. No replacement.
Using map here instead of pluck, as these values are translatable via Mobility gem
85 86 87 88 89 90 91 92 93 94 |
# File 'app/models/spree/option_value.rb', line 85 def self.to_tom_select_json Spree::Deprecation.warn('Spree::OptionValue.to_tom_select_json is deprecated and will be removed in Spree 6.3.') all.map do |ov| { id: ov.name, name: ov.label } end end |
.translation_write_permission ⇒ Object
Values are written through their option type, so they ride the same permission.
11 12 13 |
# File 'app/models/spree/option_value.rb', line 11 def self. 'write_products' end |
Instance Method Details
#display_presentation ⇒ String
Deprecated.
No replacement, build the label in the presentation layer instead.
Returns the presentation with the option type presentation, eg. "Color: Red"
99 100 101 102 103 |
# File 'app/models/spree/option_value.rb', line 99 def display_presentation Spree::Deprecation.warn('Spree::OptionValue#display_presentation is deprecated and will be removed in Spree 6.3.') @display_presentation ||= "#{option_type.label}: #{label}" end |