mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add include documentation to serialization
This commit is contained in:
parent
e34a4014ad
commit
d089ee8639
1 changed files with 6 additions and 1 deletions
|
@ -64,7 +64,12 @@ module ActiveModel
|
|||
# person.to_json # => "{\"name\":\"Bob\"}"
|
||||
# person.to_xml # => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<serial-person...
|
||||
#
|
||||
# Valid options are <tt>:only</tt>, <tt>:except</tt> and <tt>:methods</tt> .
|
||||
# Valid options are <tt>:only</tt>, <tt>:except</tt>, <tt>:methods</tt> and <tt>include</tt>.
|
||||
# The following are all valid examples:
|
||||
#
|
||||
# person.serializable_hash(:only => 'name')
|
||||
# person.serializable_hash(:include => :address)
|
||||
# person.serializable_hash(:include => { :address => { :only => 'city' }})
|
||||
module Serialization
|
||||
def serializable_hash(options = nil)
|
||||
options ||= {}
|
||||
|
|
Loading…
Reference in a new issue