In a Rails app Chewy gem is used to handle ElasticSearch indexing.
I have a block of code in an after_commit
and I need it to be run once a new record of the RDB is indexed in our NRDB. it looks like:
class User < ApplicationRecord
update_index('USER') { self }
after_commit :run_this_block, on: :create
def run_this_block
index = UsersIndex.find id
'do something with index'
end
end
seems the after_commit
is called before update_index
!!!
Nothing is found in chewy gem,
Anyone with any idea?