From 167ce0871b8deb714849583dc95982e9865636f3 Mon Sep 17 00:00:00 2001 From: Diego Carrion Date: Fri, 12 Jun 2015 18:19:00 -0300 Subject: add doc about how empty serialization objects are persisted the test case for this commit is in cd3f5db --- activerecord/lib/active_record/attribute_methods/serialization.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index fd7099e0de..ede8bba922 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -11,6 +11,8 @@ module ActiveRecord # serialized object must be of that class on assignment and retrieval. # Otherwise SerializationTypeMismatch will be raised. # + # Empty objects as +{}+ in the case of +Hash+ or +[]+ in the case of +Array+ will always be persisted as null. + # # Keep in mind that database adapters handle certain serialization tasks # for you. For instance: +json+ and +jsonb+ types in PostgreSQL will be # converted between JSON object/array syntax and Ruby +Hash+ or +Array+ -- cgit v1.2.3