class ActiveRecord::Associations::CountLoader
Public Instance Methods
load_target()
click to toggle source
Not preloaded behaviour of count_loader association When this method is called, it will be N+1 query
# File lib/active_record/precount/reflection_extension.rb, line 6 def load_target count_target = reflection.name.to_s.sub(/_count\z/, '').to_sym @target = owner.association(count_target).size loaded! unless loaded? target rescue ActiveRecord::RecordNotFound reset end