Reputation: 1047
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:
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!
Upvotes: 4
Views: 950
Reputation: 1580
They've actually changed async syntax.
With newer versions of sucker_punch, you should call async like so:
Model.perform_async
It's mentioned under the Backwards Compatibility heading here https://github.com/brandonhilkert/sucker_punch
Upvotes: 1
Reputation: 1047
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
Upvotes: 7