We've been mocking up our email jobs with success until we actually included our SendGrid Gem at the top of our worker
require 'sendgrid-ruby'
include SendGrid
class Notifications::WelcomeWorker
include Sidekiq::Worker
def perform(email_id)
emailAddr = Email.find(email_id)
...
end
end
The problem seems to arise because SendGrid has the same model within (Email)
thus generating the message
undefined method `find' for SendGrid::Email:Class
I've tried calling Email via ApplicationRecord::Email to be more context specific but to no avail.
All the SO and other guides generally go with change our model name, but I feel like there must be a better way. To be clear we are running Rails 5 so I'm wondering if theres been an update in it to address this issue which I simply haven't found.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…