Closed timpwbaker closed 3 years ago
I found a solution to my exact issue.
The clash is avoided if I move the include into the task action block:
namespace :important_task do
desc "Does some important thing"
task :action => :environment do
require 'sendgrid-ruby'
include SendGrid
ImportantThingWorker.perform
end
end
It would still be a problem however if I wanted to access the Client model inside the rake task:
namespace :assignments_email do
desc "Sends the assignments backup"
task :send => :environment do
require 'sendgrid-ruby'
include SendGrid
Client.create(name:"foo")
end
end
rake assignments_email:send # => TypeError: superclass mismatch for class Client
Issue Summary
I have an ActiveRecord model
Client
and a rake task that includes sendgrid.Within the
rake db:seed
task I cannot access Client, trying to interact with theClient
class in any way results in "TypeError: superclass mismatch for class Client"Steps to Reproduce
Exception/Log
Technical details: