1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Updated create! documentation description and added +attributes+ for rdoc

This commit is contained in:
Tom Kadwill 2014-08-06 18:52:48 +01:00
parent 3dfcae6afa
commit 38b6b5db58

View file

@ -36,8 +36,11 @@ module ActiveRecord
end
end
# Creates an object just like Base.create but calls <tt>save!</tt> instead of +save+
# so an exception is raised if the record is invalid.
# Creates an object (or multiple objects) and saves it to the database, if validations pass.
# Works like Base#create except that it raises a RecordInvalid error if validations fail.
#
# The +attributes+ parameter can be either a Hash or an Array of Hashes.
# These Hashes describe the attributes on the objects that are to be created.
def create!(attributes = nil, &block)
if attributes.is_a?(Array)
attributes.collect { |attr| create!(attr, &block) }