diff options
author | Florent Guilleux <florent2@gmail.com> | 2011-08-08 19:31:03 -0500 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-08-13 16:22:34 -0700 |
commit | 56efdbc6260f49fdf8d82d8557f233a7df3beafa (patch) | |
tree | 032bafe9963c4f2e2589188724d41f81570b94d1 | |
parent | 1b0d03b5db04f19d9428959844624a47f6ba1a2f (diff) | |
download | rails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.tar.gz rails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.tar.bz2 rails-56efdbc6260f49fdf8d82d8557f233a7df3beafa.zip |
Document exclamation point on dynamic finders
-rw-r--r-- | activerecord/lib/active_record/base.rb | 4 |
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 |