aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-05-29 08:20:42 -0600
committerSean Griffin <sean@thoughtbot.com>2015-05-29 08:21:16 -0600
commit343dad9617e7448bf8effc7c70ae13bede38fd32 (patch)
tree2ffde5ed73bf9b44d34382edbf7e7ca78165d13d /activerecord/lib
parentf5559111b55d99a2862b83eed6f2882b2f59bbd9 (diff)
parentbbdcbbc98e997e34f4cf7e9a0a0046744911b5a0 (diff)
downloadrails-343dad9617e7448bf8effc7c70ae13bede38fd32.tar.gz
rails-343dad9617e7448bf8effc7c70ae13bede38fd32.tar.bz2
rails-343dad9617e7448bf8effc7c70ae13bede38fd32.zip
Merge pull request #20364 from ernie/update-serialize-docs
Update docs for ActiveRecord `serialize` [ci skip]
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/attribute_methods/serialization.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb
index d0d8a968c5..fd7099e0de 100644
--- a/activerecord/lib/active_record/attribute_methods/serialization.rb
+++ b/activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -11,6 +11,15 @@ module ActiveRecord
# serialized object must be of that class on assignment and retrieval.
# Otherwise <tt>SerializationTypeMismatch</tt> will be raised.
#
+ # 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+
+ # objects transparently. There is no need to use +serialize+ in this
+ # case.
+ #
+ # For more complex cases, such as conversion to or from your application
+ # domain objects, consider using the ActiveRecord::Attributes API.
+ #
# ==== Parameters
#
# * +attr_name+ - The field name that should be serialized.