From 7e1672b5f503ff8dfd8cff062ee3f0d228cdf04d Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Sun, 14 Dec 2008 13:45:34 +0000 Subject: [PATCH] Make exceptions raise from find_by_foo! have a more helpful message --- activerecord/lib/active_record/base.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index a23518b..83b474d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1829,7 +1829,7 @@ module ActiveRecord #:nodoc: else find(:#{finder}, options.merge(finder_options)) end - #{'result || raise(RecordNotFound)' if bang} + #{'result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attributes.to_a.collect {|pair| "#{pair.first} = #{pair.second}"}.join(\', \')}")' if bang} end }, __FILE__, __LINE__ send(method_id, *arguments) -- 1.6.0.1