diff options
author | Severin Schoepke <severin.schoepke@gmail.com> | 2013-10-25 14:45:52 +0200 |
---|---|---|
committer | Severin Schoepke <severin.schoepke@gmail.com> | 2013-10-25 17:05:42 +0200 |
commit | c3606afb2a54ac11e31360cf1dbe13fbdf893f73 (patch) | |
tree | 8296d1af679f6f331531ca46b204c415ab94019c /activerecord/lib/active_record | |
parent | 3c3ffac0117a9a3ce4de1f84a7a3eb7a35d016a8 (diff) | |
download | rails-c3606afb2a54ac11e31360cf1dbe13fbdf893f73.tar.gz rails-c3606afb2a54ac11e31360cf1dbe13fbdf893f73.tar.bz2 rails-c3606afb2a54ac11e31360cf1dbe13fbdf893f73.zip |
cast json values on write to be consistent with reading from the db.
See also commit 5ac2341fab689344991b2a4817bd2bc8b3edac9d
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index 4babee07b4..6c5792954f 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -249,6 +249,10 @@ module ActiveRecord end class Json < Type + def type_cast_for_write(value) + ConnectionAdapters::PostgreSQLColumn.json_to_string value + end + def type_cast(value) return if value.nil? |