diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-25 08:17:40 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-25 08:17:40 -0700 |
commit | dc8fac1cacb120dc2535b67bdd6436d220901c7a (patch) | |
tree | 0949275d6b2bc9827ab9a35b88575cbb423f8456 /activerecord/lib | |
parent | 0e918ea97acc71e23e7a43963a5147d0ad8a994d (diff) | |
parent | c3606afb2a54ac11e31360cf1dbe13fbdf893f73 (diff) | |
download | rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.tar.gz rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.tar.bz2 rails-dc8fac1cacb120dc2535b67bdd6436d220901c7a.zip |
Merge pull request #12643 from severin/pg_cast_json_on_write
cast json values on write to be consistent with reading from the db.
Diffstat (limited to 'activerecord/lib')
-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? |