Class: Mobility::Backends::ActiveRecord::Hstore
- Inherits:
-
PgHash
- Object
- PgHash
- Mobility::Backends::ActiveRecord::Hstore
- Defined in:
- lib/mobility/backends/active_record/hstore.rb
Backend Accessors collapse
-
#read(locale, options = {}) ⇒ Object
Gets the translated value for provided locale from configured backend.
-
#write(locale, value, options = {}) ⇒ Object
Updates translation for provided locale without calling backend’s methods to persist the changes.
Class Method Summary collapse
-
.build_node(attr, locale) ⇒ Mobility::Plugins::Arel::Nodes::Hstore
Arel node for value of attribute key on hstore column.
Methods included from Mobility::Backends::ActiveRecord
Class Method Details
.build_node(attr, locale) ⇒ Mobility::Plugins::Arel::Nodes::Hstore
Returns Arel node for value of attribute key on hstore column.
29 30 31 32 |
# File 'lib/mobility/backends/active_record/hstore.rb', line 29 def self.build_node(attr, locale) column_name = column_affix % attr Plugins::Arel::Nodes::Hstore.new(model_class.arel_table[column_name], build_quoted(locale)) end |
Instance Method Details
#read(locale, options = {}) ⇒ Object
Gets the translated value for provided locale from configured backend.
|
# File 'lib/mobility/backends/active_record/hstore.rb', line 15
|
#write(locale, value, options = {}) ⇒ Object
Updates translation for provided locale without calling backend’s methods to persist the changes.
20 21 22 |
# File 'lib/mobility/backends/active_record/hstore.rb', line 20 def write(locale, value, = {}) super(locale, value && value.to_s, **) end |