Method: ActiveRecord::QueryMethods#strict_loading

Defined in:
lib/active_record/relation/query_methods.rb

#strict_loading(value = true) ⇒ Object

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


1016
1017
1018
# File 'lib/active_record/relation/query_methods.rb', line 1016

def strict_loading(value = true)
  spawn.strict_loading!(value)
end