Module: Spree::LabelTranslatable

Extended by:
ActiveSupport::Concern
Includes:
TranslatableResource
Included in:
OptionType, OptionValue
Defined in:
app/models/concerns/spree/label_translatable.rb

Overview

Shared by models whose single translatable field is label (OptionType, OptionValue). Carries the Mobility setup and the translation-table normalizer in one place so the two models don't restate it.

Constant Summary collapse

TRANSLATABLE_FIELDS =
%i[label].freeze

Instance Method Summary collapse

Methods included from TranslatableResource

#get_field_with_locale, #translatable_store, #upsert_translations

Instance Method Details

#presentation(*args, **kwargs) ⇒ Object

Deprecated.

The column is label since 6.0; removed in 6.3.

Unlike the attribute aliases the other 6.0 renames use, this is a plain method — Mobility owns label, so it cannot be an alias_attribute. It therefore reads and writes only on an instance: where(presentation:) and find_by(presentation:) name a column that no longer exists and raise. Query by label.



26
27
28
29
# File 'app/models/concerns/spree/label_translatable.rb', line 26

def presentation(*args, **kwargs)
  Spree::Deprecation.warn("#{self.class.name}#presentation is deprecated and will be removed in Spree 6.3. Use #label instead.")
  label(*args, **kwargs)
end

#presentation=(value) ⇒ Object

Deprecated.

See #presentation; removed in 6.3.



32
33
34
35
# File 'app/models/concerns/spree/label_translatable.rb', line 32

def presentation=(value)
  Spree::Deprecation.warn("#{self.class.name}#presentation= is deprecated and will be removed in Spree 6.3. Use #label= instead.")
  self.label = value
end