diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb index a65ca83f77..0a48a14b06 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb @@ -7,7 +7,11 @@ module ActiveRecord :hstore end - def type_cast_for_write(value) + def type_cast_from_user(value) + type_cast(type_cast_for_database(value)) + end + + def type_cast_for_database(value) ConnectionAdapters::PostgreSQLColumn.hstore_to_string(value) end diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb index c87422fe32..c64cf27797 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -7,7 +7,11 @@ module ActiveRecord :json end - def type_cast_for_write(value) + def type_cast_from_user(value) + type_cast(type_cast_for_database(value)) + end + + def type_cast_for_database(value) ConnectionAdapters::PostgreSQLColumn.json_to_string(value) end |