diff options
author | v.promzelev <v.promzelev@fun-box.ru> | 2016-09-23 15:52:34 +0400 |
---|---|---|
committer | v.promzelev <v.promzelev@fun-box.ru> | 2016-09-23 15:52:34 +0400 |
commit | 02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe (patch) | |
tree | 0bf726324fbdd0aa4b90c9fd11633e3918e0863d /activerecord/lib/active_record/relation | |
parent | 3b0da83c81047c783d1fe730691d367e286fbf1a (diff) | |
download | rails-02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe.tar.gz rails-02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe.tar.bz2 rails-02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe.zip |
initialize errors with name of class and other params
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 5e580ac865..97a819c5af 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -353,7 +353,7 @@ module ActiveRecord if ids.nil? error = "Couldn't find #{name}" error << " with#{conditions}" if conditions - raise RecordNotFound, error + raise RecordNotFound.new(error, name) elsif Array(ids).size == 1 error = "Couldn't find #{name} with '#{primary_key}'=#{ids}#{conditions}" raise RecordNotFound.new(error, name, primary_key, ids) @@ -361,7 +361,7 @@ module ActiveRecord error = "Couldn't find all #{name.pluralize} with '#{primary_key}': " error << "(#{ids.join(", ")})#{conditions} (found #{result_size} results, but was looking for #{expected_size})" - raise RecordNotFound, error + raise RecordNotFound.new(error, name, primary_key, ids) end end |