I have quite a few places where I enqueue a job in an after_commit hook but the job just re-instantiates the object and calls a method on it. It would be handy if you could pass *async: true* to the callback to have it executed asynchronously. Before writing the code and opening a pull request I wanted to see if this would be of use to anyone else.
The way I see it working: class Post < ApplicationRecord after_commit :notify_subscribers, on: :create, async: true private def notify_subscribers # Some long running code that needs to be async end end class AsyncCallbackJob < ApplicationJob def perform(record, method) record.send(method) end end -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.