Skip to content
  • Yuji Yaginuma's avatar
    ba615802
    Allow to set `enqueue_after_transaction_commit` to jobs when `eager_load` is true · ba615802
    Yuji Yaginuma authored
    The current code expects `active_record` to be loaded before `active_job`.
    But I think there are no guarantees about load orders. At least,
    `active_job` is loaded before `active_record` in a newer application.
    
    In that case, `EnqueueAfterTransactionCommit` isn't loaded and an application
    that uses `enqueue_after_transaction_commit` in jobs will fail with
    the following error.
    
    ```
    app/jobs/user_job.rb:2:in `<class:UserJob>': undefined method `enqueue_after_transaction_commit=' for class UserJob (NoMethodError)
    ```
    
    I removed `active_record` hook to fix this. Active Record are onld used
    inside methods in ``EnqueueAfterTransactionCommit`. So I think it's
    safe to load the module without Active Record.
    ba615802
    Allow to set `enqueue_after_transaction_commit` to jobs when `eager_load` is true
    Yuji Yaginuma authored
    The current code expects `active_record` to be loaded before `active_job`.
    But I think there are no guarantees about load orders. At least,
    `active_job` is loaded before `active_record` in a newer application.
    
    In that case, `EnqueueAfterTransactionCommit` isn't loaded and an application
    that uses `enqueue_after_transaction_commit` in jobs will fail with
    the following error.
    
    ```
    app/jobs/user_job.rb:2:in `<class:UserJob>': undefined method `enqueue_after_transaction_commit=' for class UserJob (NoMethodError)
    ```
    
    I removed `active_record` hook to fix this. Active Record are onld used
    inside methods in ``EnqueueAfterTransactionCommit`. So I think it's
    safe to load the module without Active Record.
Loading