aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2016-10-15 09:35:28 -0400
committerGitHub <noreply@github.com>2016-10-15 09:35:28 -0400
commitd80611d32084c86f72226907099c09f2709d667f (patch)
tree1e4b14cc93ab1436231d12d8fbbc51af5ffc81d2 /activerecord
parentbe6990bf01f422ab79dcd4c8660a04ecdc5a9a5c (diff)
parent02bcd71960c3ec6073d4ef2e9b5d208ceeaa61fe (diff)
downloadrails-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')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb4
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