1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

View file

@ -657,7 +657,7 @@ module ActiveRecord
# => #<ActiveRecord::Associations::CollectionProxy> # => #<ActiveRecord::Associations::CollectionProxy>
def strict_loading!(value = true, mode: :all) def strict_loading!(value = true, mode: :all)
unless [:all, :n_plus_one_only].include?(mode) 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 end
@strict_loading_mode = mode @strict_loading_mode = mode