diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb new file mode 100644 index 0000000000..d1347c7bb5 --- /dev/null +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -0,0 +1,27 @@ +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 |