Permalink
Browse files

Document exclamation point on dynamic finders

  • Loading branch information...
1 parent 1b0d03b commit 56efdbc6260f49fdf8d82d8557f233a7df3beafa Florent Guilleux committed with fxn Aug 9, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 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

0 comments on commit 56efdbc

Please sign in to comment.