aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorFlorent Guilleux <florent2@gmail.com>2011-08-08 19:31:03 -0500
committerXavier Noria <fxn@hashref.com>2011-08-13 16:22:34 -0700
commit56efdbc6260f49fdf8d82d8557f233a7df3beafa (patch)
tree032bafe9963c4f2e2589188724d41f81570b94d1 /activerecord/lib/active_record
parent1b0d03b5db04f19d9428959844624a47f6ba1a2f (diff)
downloadrails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.tar.gz
rails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.tar.bz2
rails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.zip
Document exclamation point on dynamic finders
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 4136868b39..b3a0267276 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -177,6 +177,10 @@ module ActiveRecord #:nodoc:
# And instead of writing <tt>Person.where(:last_name => last_name).all</tt>, you just do
# <tt>Person.find_all_by_last_name(last_name)</tt>.
#
+ # It's possible to add an exclamation point (!) on the end of the dynamic finders to get them to raise an
+ # <tt>ActiveRecord::RecordNotFound</tt> error if they do not return any records,
+ # like <tt>Person.find_by_last_name!</tt>.
+ #
# It's also possible to use multiple attributes in the same find by separating them with "_and_".
#
# Person.where(:user_name => user_name, :password => password).first