Display invalid value in error (#44255)

* Display invalid value in error

* Update activerecord/lib/active_record/core.rb

Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
This commit is contained in:
Justin Gordon 2022-01-26 16:00:52 -10:00 committed by GitHub
parent 436a307cd6
commit efae65d005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -657,7 +657,7 @@ module ActiveRecord
# => #<ActiveRecord::Associations::CollectionProxy>
def strict_loading!(value = true, mode: :all)
unless [:all, :n_plus_one_only].include?(mode)
raise ArgumentError, "The :mode option must be one of [:all, :n_plus_one_only]."
raise ArgumentError, "The :mode option must be one of [:all, :n_plus_one_only] but #{mode.inspect} was provided."
end
@strict_loading_mode = mode