Skip to content

Instantly share code, notes, and snippets.

@aahmad
Created February 21, 2014 15:23
Show Gist options
  • Save aahmad/9136130 to your computer and use it in GitHub Desktop.
Save aahmad/9136130 to your computer and use it in GitHub Desktop.
after_commit :reindex_es_async
def reindex_es_async
begin
Elasticsearch.reindex "Event", self.event_id
rescue
end
end
Sidekiq:
def perform model_to_reindex, id
model_to_reindex.constantize.find(id).try(:reindex)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment