Class: ActiveRecord::QueryMethods::WhereChain

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_extensions/active_record/query_methods.rb

Instance Method Summary collapse

Instance Method Details

#associated(*associations) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/rails_extensions/active_record/query_methods.rb', line 8

def associated(*associations)
  associations.each do |association|
    reflection = scope_association_reflection(association)
    @scope.joins!(association)
    self.not(association => { reflection.association_primary_key => nil })
  end

  @scope
end