Class: AmsLazyRelationships::Loaders::SimpleHasMany
- Defined in:
- lib/ams_lazy_relationships/loaders/simple_has_many.rb
Overview
Batch loads ActiveRecord records belonging to given record by foreign key. Useful when the relationship is not a standard ActiveRecord relationship.
Instance Method Summary collapse
-
#initialize(association_class_name, foreign_key:) ⇒ SimpleHasMany
constructor
A new instance of SimpleHasMany.
Methods inherited from Base
Constructor Details
#initialize(association_class_name, foreign_key:) ⇒ SimpleHasMany
Returns a new instance of SimpleHasMany.
14 15 16 17 |
# File 'lib/ams_lazy_relationships/loaders/simple_has_many.rb', line 14 def initialize(association_class_name, foreign_key:) @association_class_name = association_class_name @foreign_key = foreign_key.to_sym end |