Reputation: 5510
For some reason, I'm getting an error when I am trying to use ActiveJob::Exceptions retry_on
method. The docs show this usage:
class RemoteServiceJob < ActiveJob::Base
retry_on CustomAppException # defaults to 3s wait, 5 attempts
...
...
...
end
But when I do this, I'm getting an undefined method error:
"undefined method `retry_on'...(NoMethodError)"
My code is exactly like the above, except that I am retrying on a different error. The class where I am attempting to do this is a job that inherits from a BaseJob
classt that inherits from ActiveJob::Base
.
Does anyone have any idea why I might be getting this result? Why wouldn't the method be defined if I'm extending ActiveJob::Base
?
Upvotes: 1
Views: 403
Reputation: 118271
Because retry_on got added to Rails 5.1. It is not available before 5.1. As you said, you are using Rails 4, so the exception is legitimate.
Upvotes: 4