When Can After Create Call Back Rollback?

75 views Asked by At
  • The use case is we are having a lms_status model & in the model having after_create callback with if condition.

  • I found that when if conditions is true then the code inside the after_create executed properly but in the lms_statuses table no entry created.

  • It seems that after created it also deleted from table.

    class LmsStatus
    
     after_create :enqueue_order_item, if: ->{ status == 6 }
    
     def enqueue_order_item
      //code working fine
     end   
    
    end
    
  • It is happening for some of the lms_status object/entry not always.

  • Is it possible that after_create callback after executing the code inside callback can rollback ? If Yes then for those lms_statuses, it is reverting I do not want to execute the callback code. How can I prevent ?

0

There are 0 answers