aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorFrederick Cheung <frederick.cheung@gmail.com>2008-12-17 23:37:55 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-12-18 19:19:35 +0000
commit428e77bf0fcee4369cb8d94011141f791b8e2ba9 (patch)
tree86b37e8e7b7b75b8dec2afe0bbcbc5b0a5b8045c /activerecord
parenta9fde9a2abd6a6505d5fd197ad9640470d8df9be (diff)
downloadrails-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]
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
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)