diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-03-12 15:02:18 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-03-12 15:03:04 +0000 |
commit | a01f0ab83981f0ea15a1f683b84186961732f416 (patch) | |
tree | e9c980c0a4327e871e7b9eb9b65e3c9c5db5c361 /activerecord | |
parent | 90d96353e6dcd962b182e03f53f2214acde00907 (diff) | |
download | rails-a01f0ab83981f0ea15a1f683b84186961732f416.tar.gz rails-a01f0ab83981f0ea15a1f683b84186961732f416.tar.bz2 rails-a01f0ab83981f0ea15a1f683b84186961732f416.zip |
Add documentation for find_or_create_by_{attribute}! method.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 9c4d4cb274..425cd8cbab 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -208,6 +208,9 @@ module ActiveRecord #:nodoc: # # Now 'Bob' exist and is an 'admin' # User.find_or_create_by_name('Bob', :age => 40) { |u| u.admin = true } # + # Adding an exclamation point (!) on to the end of <tt>find_or_create_by_</tt> will + # raise an <tt>ActiveRecord::RecordInvalid</tt> error if the new record is invalid. + # # Use the <tt>find_or_initialize_by_</tt> finder if you want to return a new record without # saving it first. Protected attributes won't be set unless they are given in a block. # |