Class: ActiveRecord::Associations::CountLoader
- Inherits:
-
SingularAssociation
- Object
- SingularAssociation
- ActiveRecord::Associations::CountLoader
- Defined in:
- lib/active_record/associations/count_loader.rb
Instance Method Summary collapse
-
#load_target ⇒ Object
Not preloaded behaviour of count_loader association When this method is called, it will be N+1 query.
Instance Method Details
#load_target ⇒ Object
Not preloaded behaviour of count_loader association When this method is called, it will be N+1 query
6 7 8 9 10 11 12 13 14 |
# File 'lib/active_record/associations/count_loader.rb', line 6 def load_target count_target = reflection.name_without_count.to_sym @target = owner.association(count_target).count loaded! unless loaded? target rescue ActiveRecord::RecordNotFound reset end |