Class: ActiverecordReindex::Reindexer
- Inherits:
-
Object
- Object
- ActiverecordReindex::Reindexer
- Defined in:
- lib/activerecord_reindex/reindexer.rb
Instance Method Summary collapse
-
#call(record, reflection:, skip_record:) ⇒ Object
reindex records associated with given record on given association if association is collection(has_many, has_many_through, has_and_belongs_to_many) get all associated recrods and reindex them else reindex given record associted one.
-
#with_strategy(strategy) ⇒ Object
chain strategy before actual executing strategy can be either sync or async corresponding to type of reindexing additional strategies can be defined and specified by user.
Instance Method Details
#call(record, reflection:, skip_record:) ⇒ Object
reindex records associated with given record on given association if association is collection(has_many, has_many_through, has_and_belongs_to_many)
get all associated recrods and reindex them
else
reindex given record associted one
24 25 26 27 28 29 30 |
# File 'lib/activerecord_reindex/reindexer.rb', line 24 def call(record, reflection:, skip_record:) if reflection.collection? _reindex_collection(reflection, record, skip_record) else _reindex_single(reflection, record, skip_record) end end |
#with_strategy(strategy) ⇒ Object
chain strategy before actual executing strategy can be either sync or async corresponding to type of reindexing additional strategies can be defined and specified by user
12 13 14 15 |
# File 'lib/activerecord_reindex/reindexer.rb', line 12 def with_strategy(strategy) @strategy = strategy self end |