Class: Gitlab::Database::Type::SymbolizedJsonb
- Inherits:
-
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Jsonb
- Object
- ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Jsonb
- Gitlab::Database::Type::SymbolizedJsonb
- Defined in:
- lib/gitlab/database/type/symbolized_jsonb.rb
Overview
Extends Rails’ Jsonb data type to deserialize it into symbolized Hash.
Example:
class SomeModel < ApplicationRecord
# some_model.a_field is of type `jsonb`
attribute :a_field, :sym_jsonb
end
Instance Method Summary collapse
Instance Method Details
#deserialize(value) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/gitlab/database/type/symbolized_jsonb.rb', line 19 def deserialize(value) data = super return unless data ::Gitlab::Utils.deep_symbolized_access(data) end |
#type ⇒ Object
15 16 17 |
# File 'lib/gitlab/database/type/symbolized_jsonb.rb', line 15 def type :sym_jsonb end |