diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2008-12-17 23:37:55 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-12-18 19:19:35 +0000 |
commit | 428e77bf0fcee4369cb8d94011141f791b8e2ba9 (patch) | |
tree | 86b37e8e7b7b75b8dec2afe0bbcbc5b0a5b8045c | |
parent | a9fde9a2abd6a6505d5fd197ad9640470d8df9be (diff) | |
download | rails-428e77bf0fcee4369cb8d94011141f791b8e2ba9.tar.gz rails-428e77bf0fcee4369cb8d94011141f791b8e2ba9.tar.bz2 rails-428e77bf0fcee4369cb8d94011141f791b8e2ba9.zip |
Make exceptions raise from find_by_foo! have a more helpful message [#1567 state:resolved]
-rwxr-xr-x | 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 87c0002463..dfead0b94f 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) |