Class: NumberedRelationships::HasManyThroughConstructor

Inherits:
Constructor
  • Object
show all
Defined in:
lib/numbered_relationships/has_many_through.rb

Instance Method Summary collapse

Methods inherited from Constructor

#initialize

Constructor Details

This class inherits a constructor from NumberedRelationships::Constructor

Instance Method Details

#constructObject



5
6
7
8
9
10
# File 'lib/numbered_relationships/has_many_through.rb', line 5

def construct
  super
  @klass.joins(through_model, association)
      .group("#{table}.id")
      .having("count(#{association.to_s}.id) #{@operator} #{@n}")
end