Permalink
Browse files

Make exceptions raise from find_by_foo! have a more helpful message [#…

…1567 state:resolved]
  • Loading branch information...
1 parent a9fde9a commit 428e77bf0fcee4369cb8d94011141f791b8e2ba9 @fcheung fcheung committed with lifo Dec 17, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/base.rb
@@ -1829,7 +1829,7 @@ def self.#{method_id}(*args)
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)

0 comments on commit 428e77b

Please sign in to comment.