Method: ActiveRecord::QueryMethods#strict_loading
- Defined in:
- activerecord/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
1302 1303 1304 |
# File 'activerecord/lib/active_record/relation/query_methods.rb', line 1302 def strict_loading(value = true) spawn.strict_loading!(value) end |