From e8460f8bbe73537897f2162d1cccda943d8c0f4a Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Wed, 21 Jan 2015 11:47:11 -0700 Subject: Don't error when invalid json is assigned to a JSON column Keeping with our behavior elsewhere in the system, invalid input is assumed to be `nil`. Fixes #18629. --- .../lib/active_record/connection_adapters/postgresql/oid/json.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters') 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 e12ddd9901..7dadc09a44 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb @@ -11,7 +11,7 @@ module ActiveRecord def type_cast_from_database(value) if value.is_a?(::String) - ::ActiveSupport::JSON.decode(value) + ::ActiveSupport::JSON.decode(value) rescue nil else super end -- cgit v1.2.3