提交 3e302bc6 编写于 作者: Y yui-knk

[ci skip] Improve the readability of documents of nested_attributes

上级 42ad173d
...@@ -195,15 +195,23 @@ class TooManyRecords < ActiveRecordError ...@@ -195,15 +195,23 @@ class TooManyRecords < ActiveRecordError
# Nested attributes for an associated collection can also be passed in # Nested attributes for an associated collection can also be passed in
# the form of a hash of hashes instead of an array of hashes: # the form of a hash of hashes instead of an array of hashes:
# #
# Member.create(name: 'joe', # Member.create(
# posts_attributes: { first: { title: 'Foo' }, # name: 'joe',
# second: { title: 'Bar' } }) # posts_attributes: {
# first: { title: 'Foo' },
# second: { title: 'Bar' }
# }
# )
# #
# has the same effect as # has the same effect as
# #
# Member.create(name: 'joe', # Member.create(
# posts_attributes: [ { title: 'Foo' }, # name: 'joe',
# { title: 'Bar' } ]) # posts_attributes: [
# { title: 'Foo' },
# { title: 'Bar' }
# ]
# )
# #
# The keys of the hash which is the value for +:posts_attributes+ are # The keys of the hash which is the value for +:posts_attributes+ are
# ignored in this case. # ignored in this case.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册