mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #42274 from martinjaimem/fix/without-argument-error-message
Fix ArgumentError message for without method
This commit is contained in:
commit
e888e3cf87
2 changed files with 4 additions and 1 deletions
|
@ -1162,7 +1162,7 @@ module ActiveRecord
|
|||
records.compact!
|
||||
|
||||
unless records.all?(klass)
|
||||
raise ArgumentError, "You must only pass a single or collection of #{klass.name} objects to #excluding."
|
||||
raise ArgumentError, "You must only pass a single or collection of #{klass.name} objects to ##{__callee__}."
|
||||
end
|
||||
|
||||
spawn.excluding!(records)
|
||||
|
|
|
@ -48,6 +48,9 @@ class ExcludingTest < ActiveRecord::TestCase
|
|||
def test_raises_on_record_from_different_class
|
||||
error = assert_raises(ArgumentError) { Post.excluding(@post, comments(:greetings)) }
|
||||
assert_equal "You must only pass a single or collection of Post objects to #excluding.", error.message
|
||||
|
||||
error = assert_raises(ArgumentError) { Post.without(@post, comments(:greetings)) }
|
||||
assert_equal "You must only pass a single or collection of Post objects to #without.", error.message
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue