I have a product
table and I try to run after_commit and after_rollback on create.
controller:
product = Product.new form_params
if product.save
# code
else
# code
end
model:
after_commit(on: :create) {
# code
}
after_rollback(on: :create) {
# code
}
after_commit works well but after_rollback wont work with on: :create
param. When I remove the on: :create
param, it triggers too but I need after_rollback to trigger just on create.