aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-03-12 15:02:18 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2012-03-12 15:02:18 +0000
commitca99beb4a9fc983603e2427255afa97c63cc4cfc (patch)
tree95ad11daa05cdafd7f11d649ca6f0a3324790ce5 /activerecord/lib/active_record
parenteee32af45e7909c02370324833d7117fe9b6eb37 (diff)
downloadrails-ca99beb4a9fc983603e2427255afa97c63cc4cfc.tar.gz
rails-ca99beb4a9fc983603e2427255afa97c63cc4cfc.tar.bz2
rails-ca99beb4a9fc983603e2427255afa97c63cc4cfc.zip
Add documentation for find_or_create_by_{attribute}! method.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index d4d0220fb7..d25a821688 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -201,6 +201,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.
#