diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2016-10-15 09:35:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-15 09:35:28 -0400 |
commit | d80611d32084c86f72226907099c09f2709d667f (patch) | |
tree | 1e4b14cc93ab1436231d12d8fbbc51af5ffc81d2 /activerecord/lib | |
parent | be6990bf01f422ab79dcd4c8660a04ecdc5a9a5c (diff) | |
parent | 02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe (diff) | |
download | rails-d80611d32084c86f72226907099c09f2709d667f.tar.gz rails-d80611d32084c86f72226907099c09f2709d667f.tar.bz2 rails-d80611d32084c86f72226907099c09f2709d667f.zip |
Merge pull request #26598 from rutaka-n/raise_record_not_found_with_correct_params
initialize errors with name of class and other params
Diffstat (limited to 'activerecord/lib')
-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 |