diff options
Diffstat (limited to 'activerecord/lib/active_record/relation/finder_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 25e23a9d55..563843f3cc 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -123,9 +123,10 @@ module ActiveRecord end end - # Same as #first! but raises RecordNotFound if no record is returned - def first!(*args) - self.first(*args) or raise RecordNotFound + # Same as +first+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record + # is found. Note that <tt>first!</tt> accepts no arguments. + def first! + first or raise RecordNotFound end # A convenience wrapper for <tt>find(:last, *args)</tt>. You can pass in all the @@ -142,9 +143,10 @@ module ActiveRecord end end - # Same as #last! but raises RecordNotFound if no record is returned - def last!(*args) - self.last(*args) or raise RecordNotFound + # Same as +last+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record + # is found. Note that <tt>last!</tt> accepts no arguments. + def last! + last or raise RecordNotFound end # A convenience wrapper for <tt>find(:all, *args)</tt>. You can pass in all the |