Module: Spree::PresentationTranslatable

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

Overview

Shared by models whose single translatable field is the legacy presentation column exposed publicly as label (OptionType, OptionValue). Carries the Mobility setup, the translation-table normalizer, the locale-aware +label+/+label=+ bridge, and the label → presentation translation-matrix alias in one place so the two models don't restate it.

Constant Summary collapse

TRANSLATABLE_FIELDS =
%i[presentation].freeze

Instance Method Summary collapse

Methods included from TranslatableResource

#get_field_with_locale, #translatable_store, #upsert_translations

Instance Method Details

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

alias_attribute bypasses Mobility's locale-aware reader/writer, so these explicit delegations are required to keep label translation-aware.



31
32
33
# File 'app/models/concerns/spree/presentation_translatable.rb', line 31

def label(*args, **kwargs)
  presentation(*args, **kwargs)
end

#label=(value) ⇒ Object



35
36
37
# File 'app/models/concerns/spree/presentation_translatable.rb', line 35

def label=(value)
  self.presentation = value
end