Module: ActiveRecordHas
- Defined in:
- lib/active_record_has/scope.rb,
lib/active_record_has/version.rb,
lib/active_record_has/through_methods.rb,
lib/active_record_has/reflection_methods.rb,
lib/active_record_has.rb
Defined Under Namespace
Modules: ReflectionMethods, ThroughMethods
Classes: Error, Scope
Constant Summary
collapse
- VERSION =
"0.1.2"
Instance Method Summary
collapse
Instance Method Details
#has(association, relation = nil, **options, &block) ⇒ Object
16
17
18
|
# File 'lib/active_record_has.rb', line 16
def has(association, relation=nil, **options, &block)
where(Scope.new(self, association, relation, **options, &block).exists)
end
|
#has_not(association, relation = nil, **options, &block) ⇒ Object
20
21
22
|
# File 'lib/active_record_has.rb', line 20
def has_not(association, relation=nil, **options, &block)
where.not(Scope.new(self, association, relation, **options, &block).exists)
end
|