-
Notifications
You must be signed in to change notification settings - Fork 120
Closed
Description
• Rails version: 5.1.6
• Algolia Rails integration version: 1.22
Description
@algolia_must_reindex is reset in every validate call. This means that a record
that is updated multiple times in a transaction will only be indexed if the
final update marks as must reindex
Steps To Reproduce
class AnyModel < ActiveRecord::Base
include AlgoliaSearch
algoliasearch do
attribute(:name)
end
end
# after_commit will have @algolia_must_reindex = false
AnyModel.transaction do
instance_of_model.update!(name: "foobar")
instance_of_model.update!(unrelated_column: 23)
endSuggested Fix
Change first line of def algolia_mark_must_reindex to
@algolia_must_reindex ||=Metadata
Metadata
Assignees
Labels
No labels