Method: ActiveRecord::Relation#to_a_with_includes_count
- Defined in:
- lib/includes-count.rb
#to_a_with_includes_count ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/includes-count.rb', line 125 def to_a_with_includes_count return @records if loaded? to_a_without_includes_count (includes_counts_values || []).each do |association_with_opts| association, opts = association_with_opts ActiveRecord::Associations::CountPreloader.new(@records, [association], opts).run end @records end |