Module: Mobility::Backend::KeyValue
- Includes:
- OrmDelegator
- Defined in:
- lib/mobility/backend/key_value.rb
Overview
Stores attribute translation as attribute/value pair on a shared translations table, using a polymorphic relationship between a translation class and models using the backend. By default, two tables are assumed to be present supporting string and text translations: a mobility_text_translations
table for text-valued translations and a mobility_string_translations
table for string-valued translations (the only difference being the column type of the value
column on the table).
Backend Options
association_name
Name of association on model. Defaults to mobility_text_translations
(if type
is :text
) or mobility_string_translations
(if type
is :string
). If specified, ensure name does not overlap with other methods on model or with the association name used by other backends on model (otherwise one will overwrite the other).
type
Currently, either :text
or :string
is supported. Determines which class to use for translations, which in turn determines which table to use to store translations (by default mobility_text_translations
for text type, mobility_string_translations
for string type).
class_name
Class to use for translations when defining association. By default, ActiveRecord::TextTranslation or ActiveRecord::StringTranslation for ActiveRecord models (similar for Sequel models). If string is passed in, it will be constantized to get the class.
Defined Under Namespace
Classes: TranslationsCache