instance method
strict_loading
Ruby on Rails 7.1.6
Since v6.1.7.10Signature
strict_loading(value = true)
Sets the returned relation to strict_loading mode. This will raise an error if the record tries to lazily load an association.
user = User.strict_loading.first user.comments.to_a => ActiveRecord::StrictLoadingViolationError
Parameters
-
valueopt = true
Source
# File activerecord/lib/active_record/relation/query_methods.rb, line 1223
def strict_loading(value = true)
spawn.strict_loading!(value)
end
Defined in activerecord/lib/active_record/relation/query_methods.rb line 1223
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::QueryMethods