Class: Mobility::Backends::Sequel::Serialized
- Inherits:
-
Object
- Object
- Mobility::Backends::Sequel::Serialized
- Includes:
- Mobility::Backends::Sequel
- Defined in:
- lib/mobility/backends/sequel/serialized.rb
Overview
Implements Mobility::Backends::Serialized backend for Sequel models, using the Sequel serialization plugin.
Defined Under Namespace
Modules: SerializationModificationDetectionFix
Backend Configuration collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#translations ⇒ Hash
Returns deserialized column value.
Methods included from Mobility::Backends::Sequel
Class Method Details
.build_op(attr, _locale) ⇒ Object
53 54 55 56 |
# File 'lib/mobility/backends/sequel/serialized.rb', line 53 def self.build_op(attr, _locale) raise ArgumentError, "You cannot query on mobility attributes translated with the Serialized backend (#{attr})." end |
.configure(options) ⇒ Object
47 48 49 50 |
# File 'lib/mobility/backends/sequel/serialized.rb', line 47 def self.configure() super Serialized.configure() end |
.valid_keys ⇒ Object
39 40 41 |
# File 'lib/mobility/backends/sequel/serialized.rb', line 39 def self.valid_keys super + [:format] end |
Instance Method Details
#translations ⇒ Hash
Returns deserialized column value
83 84 85 86 87 88 89 90 91 |
# File 'lib/mobility/backends/sequel/serialized.rb', line 83 def translations if model.deserialized_values.has_key?(column_name) model.deserialized_values[column_name] elsif model.frozen? deserialize_value(serialized_value) else model.deserialized_values[column_name] = deserialize_value(serialized_value) end end |