Module: ActiveRecordScopingWithAssoc::Association

Defined in:
lib/activerecord_scoping_with_assoc/association.rb

Instance Method Summary collapse

Instance Method Details

#target_scopeObject



3
4
5
6
7
8
9
# File 'lib/activerecord_scoping_with_assoc/association.rb', line 3

def target_scope
  if Thread.current[KEY] && Thread.current[KEY][klass] == true
    ActiveRecord::AssociationRelation.create(klass, self).merge!(klass.current_scope)
  else
    super
  end
end