Search code examples
ruby-on-railsemailruby-on-rails-4sucker-punch

undefined method `async' (suckerpunch gem)


I am using sucker_punch gem to send the email in my rails app in the background.It used to work fine, but then I suddenly got this error:

undefined method `async' for #<ActiveJob::QueueAdapters::SuckerPunchAdapter::JobWrapper:0x007f892c6c31a0>

Below is the screenshot of the full error:

enter image description here

I am using sucker_punch version 2.0.1 right now. I have tried to downgrade it and using sucker_punch version 1.6.0 instead, but the error persist.

Any help? Thanks!


Solution

  • Okay I have finally figured it out. In my sucker_punch.rb file, I need to include this:

    # config/initializers/sucker_punch.rb
    
    require 'sucker_punch/async_syntax'
    

    This is required for those who are using Sucker Punch version 2.0.0+ with Rails < 5.0.0 as explained here