Module: Familia::Features::Relationships::Participation
- Defined in:
- lib/familia/features/relationships/participation.rb,
lib/familia/features/relationships/participation/through_model_operations.rb
Overview
Participation module for bidirectional business relationships using Valkey/Redis collections. Provides semantic, scored relationships with automatic reverse tracking.
Unlike Indexing (which is for attribute lookups), Participation manages relationships where membership has meaning, scores have semantic value, and bidirectional tracking is essential
=== Architecture Overview === This module is organized into clear, separate concerns:
- CollectionOperations: Shared helpers for all collection manipulation
- ParticipantMethods: Methods added to the class calling participates_in
- TargetMethods: Methods added to the target class specified in participates_in
This separation makes it crystal clear what methods are added to which class.
Key Differences from Indexing:
- Participation: Bidirectional relationships with semantic scores
- Indexing: Unidirectional lookups without relationship semantics
- Participation: Collection name in key (customer:123:domains)
- Indexing: Field value in key (company:123:dept_index:engineering)
When to Use Participation:
- Modeling business relationships (Customer owns Domains)
- Scores have meaning (priority, permissions, join_date)
- Need bidirectional tracking ("what collections does this belong to?")
- Relationship lifecycle matters (cascade cleanup, reverse tracking)
Defined Under Namespace
Modules: ModelClassMethods, ModelInstanceMethods, ThroughModelOperations
Class Method Summary collapse
-
.included(base) ⇒ Object
Hook called when module is included in a class.
Class Method Details
.included(base) ⇒ Object
Hook called when module is included in a class.
Extends the host class with ModelClassMethods for relationship definitions and includes ModelInstanceMethods for instance-level operations.
94 95 96 97 98 |
# File 'lib/familia/features/relationships/participation.rb', line 94 def self.included(base) base.extend ModelClassMethods base.include ModelInstanceMethods super end |