From 976e77651a5a4f847254b450eec884c7b6978c2a Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 23 Oct 2013 11:00:29 +0200 Subject: warning about saving models with dirty attributes See #8328 --- activerecord/lib/active_record/attribute_methods/serialization.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb index 1287de0d0d..6b77cc9e83 100644 --- a/activerecord/lib/active_record/attribute_methods/serialization.rb +++ b/activerecord/lib/active_record/attribute_methods/serialization.rb @@ -24,6 +24,9 @@ module ActiveRecord # serialized object must be of that class on retrieval or # SerializationTypeMismatch will be raised. # + # A notable side effect of serialized attributes is that the model will + # be updated on every save, even if it is not dirty. + # # ==== Parameters # # * +attr_name+ - The field name that should be serialized. -- cgit v1.2.3 From 1478ebf66c158bd214ed807622ec941cad4e3dee Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Wed, 30 Oct 2013 17:08:20 +0100 Subject: Hstore and JSON fields are not supported with store The use of `store` on Hstore fields (for instance) is not needed because serialization aimed to interact with Ruby objects and not with provided field types --- activerecord/lib/active_record/store.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index a610f479f2..0f616c537e 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -15,6 +15,10 @@ module ActiveRecord # You can set custom coder to encode/decode your serialized attributes to/from different formats. # JSON, YAML, Marshal are supported out of the box. Generally it can be any wrapper that provides +load+ and +dump+. # + # With PostgreSQL, the +store+ feature is not supported for field types such as Hstore + # or JSON because it would add an extra layer of serialization and this is not needed. + # Rely on +store_accessor+ instead. + # # Examples: # # class User < ActiveRecord::Base -- cgit v1.2.3 From a5176def3d9067e1aa3bfe8457f888ed45f422c9 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Wed, 6 Nov 2013 10:54:08 +0100 Subject: refine usage docs of `store` in combination with `hstore` and `json`. refs #11561 #12700 --- activerecord/lib/active_record/store.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index 0f616c537e..19c0571cc0 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -15,9 +15,9 @@ module ActiveRecord # You can set custom coder to encode/decode your serialized attributes to/from different formats. # JSON, YAML, Marshal are supported out of the box. Generally it can be any wrapper that provides +load+ and +dump+. # - # With PostgreSQL, the +store+ feature is not supported for field types such as Hstore - # or JSON because it would add an extra layer of serialization and this is not needed. - # Rely on +store_accessor+ instead. + # NOTE - If you are using special PostgreSQL columns like +hstore+ or +json+ there is no need for + # the serialization provieded by +store+. You can simply use +store_accessor+ instead to generate + # the accessor methods. # # Examples: # -- cgit v1.2.3