Проект Ruby on Rails, я запускаю Resque для обработки электронной почты (в частности, Devise и Devise Invitable). Электронные письма от Devise отправляются нормально (через API через гем postmark), но электронные письма devise_invitable не срабатывают в Resque с undefined method invitation_instructions for #User:0x0xxxxxx Did you mean? invitations_count
.
При отправке через почтовую программу devise по умолчанию все работает нормально, но с моим пользовательским почтовым ящиком происходит сбой. Я хочу добавить встроенное вложение, следовательно, требуется специальный почтовый клиент.
Custom Devise Mailer:
class DeviseMailer < Devise::Mailer
helper :application
include Devise::Controllers::UrlHelpers
include Devise::Mailers::Helpers
include DeviseInvitable::Mailer
default template_path: 'devise/mailer'
default from: sender@example.com
layout 'mailer_devise'
before_action :add_inline_attachment!
def reset_password_instructions(record, token, opts={})
super
end
def invitation_instructions(record, token, opts={})
@token = token
devise_mail(record)#, record.invitation_instructions || :invitation_instructions, opts)
end
private
def add_inline_attachment!
attachments.inline['logo.png'] = File.read(Rails.root.join('app/assets/images/logo.png'))
end
end
Резюме:
def reset_password_instructions
- отлично работает
def invitation_instructions
- сбой с неопределенной ошибкой метода