My current code for the user_controller.rb:
def create
u = User.new(create_user_params)
.
.
.
if u.save
WelcomeMailer.new_customer(u).deliver_now
render json: u.as_json(except: [:password_digest]), status: 201
else
respond_with u
end
end
The code for my Mailer is:
def new_customer(user:)
@user = user
attachments["AGB.pdf"] = File.read("#{Rails.root}/app/assets/files/AGB.pdf")
mail to: @user.email, subject: "blaa blubb"
end
and its working like a charm.
E-Mail is sent with attachment.
If I change
WelcomeMailer.new_customer(u).deliver_now
to
WelcomeMailer.new_customer(u).deliver_later
I receive the mail, but WITHOUT the attachment.
I use sidekiq as job queue (config/application.rb):
config.active_job.queue_adapter = :sidekiq
Okay...
noobish answer:
You have to restart the sidekiq-queues... Did it now after weeks an it works like a charm hittingmyself