Class: ActiveRecord::ConnectionAdapters::Redshift::OID::Json
- Inherits:
-
Type::Value
- Object
- Type::Value
- ActiveRecord::ConnectionAdapters::Redshift::OID::Json
- Includes:
- ActiveModel::Type::Helpers::Mutable
- Defined in:
- lib/active_record/connection_adapters/redshift_7_0/oid/json.rb,
lib/active_record/connection_adapters/redshift_7_1/oid/json.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #accessor ⇒ Object
- #type ⇒ Object
- #type_cast_for_database(value) ⇒ Object
- #type_cast_from_database(value) ⇒ Object
Instance Method Details
#accessor ⇒ Object
34 35 36 |
# File 'lib/active_record/connection_adapters/redshift_7_0/oid/json.rb', line 34 def accessor ActiveRecord::Store::StringKeyedHashAccessor end |
#type ⇒ Object
10 11 12 |
# File 'lib/active_record/connection_adapters/redshift_7_0/oid/json.rb', line 10 def type :json end |
#type_cast_for_database(value) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/active_record/connection_adapters/redshift_7_0/oid/json.rb', line 26 def type_cast_for_database(value) if value.is_a?(::Array) || value.is_a?(::Hash) ::ActiveSupport::JSON.encode(value) else super end end |
#type_cast_from_database(value) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_record/connection_adapters/redshift_7_0/oid/json.rb', line 14 def type_cast_from_database(value) if value.is_a?(::String) begin ::ActiveSupport::JSON.decode(value) rescue StandardError nil end else super end end |