mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[ci skip] correct doc for serialization in accordance with API Doc Guide
This commit is contained in:
parent
92de6d4c35
commit
eb5d802cab
1 changed files with 10 additions and 10 deletions
|
@ -4,7 +4,7 @@ require 'active_support/core_ext/hash/slice'
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
# == Active \Model \Serialization
|
# == Active \Model \Serialization
|
||||||
#
|
#
|
||||||
# Provides a basic serialization to a serializable_hash for your object.
|
# Provides a basic serialization to a serializable_hash for your objects.
|
||||||
#
|
#
|
||||||
# A minimal implementation could be:
|
# A minimal implementation could be:
|
||||||
#
|
#
|
||||||
|
@ -25,16 +25,16 @@ module ActiveModel
|
||||||
# person.name = "Bob"
|
# person.name = "Bob"
|
||||||
# person.serializable_hash # => {"name"=>"Bob"}
|
# person.serializable_hash # => {"name"=>"Bob"}
|
||||||
#
|
#
|
||||||
# You need to declare an attributes hash which contains the attributes you
|
|
||||||
# want to serialize. Attributes must be strings, not symbols. When called,
|
# An +attributes+ hash must be defined and should contain any attributes you
|
||||||
# serializable hash will use instance methods that match the name of the
|
# need to be serialized. Attributes must be strings, not symbols.
|
||||||
# attributes hash's keys. In order to override this behavior, take a look at
|
# When called, serializable hash will use instance methods that match the name
|
||||||
# the private method +read_attribute_for_serialization+.
|
# of the attributes hash's keys. In order to override this behavior, take a look
|
||||||
|
# at the private method +read_attribute_for_serialization+.
|
||||||
#
|
#
|
||||||
# Most of the time though, you will want to include the JSON or XML
|
# Most of the time though, either the JSON or XML serializations are needed.
|
||||||
# serializations. Both of these modules automatically include the
|
# Both of these modules automatically include the <tt>ActiveModel::Serialization</tt>
|
||||||
# <tt>ActiveModel::Serialization</tt> module, so there is no need to
|
# module, so there is no need to explicitly include it.
|
||||||
# explicitly include it.
|
|
||||||
#
|
#
|
||||||
# A minimal implementation including XML and JSON would be:
|
# A minimal implementation including XML and JSON would be:
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue