Class: ActiveRecord::Associations::CountPreloader

Inherits:
Preloader
  • Object
show all
Defined in:
lib/includes-count.rb

Defined Under Namespace

Classes: Count, CountHasMany, CountHasManyThrough

Instance Method Summary collapse

Instance Method Details

#preloader_for(reflection) ⇒ Object



98
99
100
101
102
103
104
105
# File 'lib/includes-count.rb', line 98

def preloader_for(reflection)
  case reflection.macro 
    when :has_many
      reflection.options[:through] ? CountHasManyThrough : CountHasMany
    else
      raise "unsupported association kind #{reflection.macro}"
  end
end