Module: DuckRecord::Reflection
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/duck_record/reflection.rb
Overview
Defined Under Namespace
Modules: ClassMethods
Classes: AbstractReflection, AssociationReflection, BelongsToReflection, EmbedsAssociationReflection, EmbedsManyReflection, EmbedsOneReflection, HasManyReflection, HasOneReflection, MacroReflection
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.add_reflection(ar, name, reflection) ⇒ Object
35
36
37
38
|
# File 'lib/duck_record/reflection.rb', line 35
def self.add_reflection(ar, name, reflection)
ar.clear_reflections_cache
ar._reflections = ar._reflections.merge(name.to_s => reflection)
end
|
.create(macro, name, scope, options, ar) ⇒ Object
Instance Method Details
#has_reflection?(reflection_name) ⇒ Boolean
40
41
42
|
# File 'lib/duck_record/reflection.rb', line 40
def has_reflection?(reflection_name)
_reflections.keys.include?(reflection_name.to_s)
end
|