diff options
author | Tom Kadwill <tomkadwill@gmail.com> | 2014-08-06 18:52:48 +0100 |
---|---|---|
committer | Tom Kadwill <tomkadwill@gmail.com> | 2014-08-07 08:54:03 +0100 |
commit | 38b6b5db58457b5445d2c42298facf322136c3ae (patch) | |
tree | be0efd8a5afee01d23e3df70fb0493685103816d /activerecord | |
parent | 3dfcae6afa24b641bd838b9044c5ce9aa2a1a6db (diff) | |
download | rails-38b6b5db58457b5445d2c42298facf322136c3ae.tar.gz rails-38b6b5db58457b5445d2c42298facf322136c3ae.tar.bz2 rails-38b6b5db58457b5445d2c42298facf322136c3ae.zip |
[ci skip] Updated create! documentation description and added +attributes+ for rdoc
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f35865f54c..b89e081542 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -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) } |