aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb
blob: d1347c7bb5cd0c5c227e6c57d33b027fcad7fc2f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11




                                

                               



                  

                                                                      

             

                                                                      









                                                        
module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      module OID # :nodoc:
        class Json < Type::Value
          include Type::Mutable

          def type
            :json
          end

          def type_cast_from_database(value)
            ConnectionAdapters::PostgreSQLColumn.string_to_json(value)
          end

          def type_cast_for_database(value)
            ConnectionAdapters::PostgreSQLColumn.json_to_string(value)
          end

          def accessor
            ActiveRecord::Store::StringKeyedHashAccessor
          end
        end
      end
    end
  end
end