提交 7e5beca3 编写于 作者: F Francesco Rodriguez

add CollectionProxy#create! documentation

上级 9c38cfc4
......@@ -249,6 +249,28 @@ class CollectionProxy < Relation
# # #<Pet id: 2, name: "Spook", person_id: 1>,
# # #<Pet id: 3, name: "Choo-Choo", person_id: 1>
# # ]
##
# :method: create!
#
# :call-seq:
# create!(attributes = {}, options = {}, &block)
#
# Like +create+, except that if the record is invalid will
# raise an exception.
#
# class Person
# has_many :pets
# end
#
# class Pet
# attr_accessible :name
# validates :name, presence: true
# end
#
# person.pets.create!(name: nil)
# # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
##
# :method: concat
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册