diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-12 15:13:28 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-13 14:07:41 -0600 |
commit | 4bf8ffc6516312e68fb0d2b4ac97505f8d0cf192 (patch) | |
tree | 239a8205dc68ac3bada7a2712f52f2defa159f00 /activerecord/lib/active_record/connection_adapters/postgresql/oid | |
parent | 8a3046133aba188d81f31b034d6594899b23c70c (diff) | |
download | rails-4bf8ffc6516312e68fb0d2b4ac97505f8d0cf192.tar.gz rails-4bf8ffc6516312e68fb0d2b4ac97505f8d0cf192.tar.bz2 rails-4bf8ffc6516312e68fb0d2b4ac97505f8d0cf192.zip |
Detect in-place changes on mutable AR attributes
We have several mutable types on Active Record now. (Serialized, JSON,
HStore). We need to be able to detect if these have been modified in
place.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/oid')
-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, 4 insertions, 8 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 88de816d4f..0dd4b65333 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb @@ -3,14 +3,12 @@ module ActiveRecord module PostgreSQL module OID # :nodoc: class Hstore < Type::Value + include Type::Mutable + def type :hstore end - def type_cast_from_user(value) - type_cast_from_database(type_cast_for_database(value)) - end - def type_cast_from_database(value) ConnectionAdapters::PostgreSQLColumn.string_to_hstore(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 b4fed1bcab..d1347c7bb5 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -3,14 +3,12 @@ module ActiveRecord module PostgreSQL module OID # :nodoc: class Json < Type::Value + include Type::Mutable + def type :json end - def type_cast_from_user(value) - type_cast_from_database(type_cast_for_database(value)) - end - def type_cast_from_database(value) ConnectionAdapters::PostgreSQLColumn.string_to_json(value) end |