Module: ActiveRecord::Associations::JoinDependency::HasCount

Included in:
ActiveRecord::Associations::JoinDependency
Defined in:
lib/active_record/associations/join_dependency/has_count.rb

Instance Method Summary collapse

Instance Method Details

#build_with_has_count(associations, base_klass) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/associations/join_dependency/has_count.rb', line 12

def build_with_has_count(associations, base_klass)
  associations.map do |name, right|
    reflection = find_reflection base_klass, name
    if reflection.macro == :has_count
      raise EagerLoadHasCountError.new(reflection)
    end
  end

  build_without_has_count(associations, base_klass)
end