I've got a very simple custom mailer that I am using with Devise, however it is unable to find the helper method "devise_mail".
If I clone the devise_mail method within the class (Uncommenting in the sample below) the mailer works with the custom instructions as I'd expect so the custom mailer is definately been hit, and the custom subject line used elsewhere also works with devise invitable.
The full error is:
NoMethodError: undefined method
devise_mail' for MyMailer:Class from /Users/paul/.rvm/gems/ruby-2.0.0-p598/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:259:inmethod_missing'
What am I missing?
class MyMailer < Devise::Mailer
protected
helper :application
include Devise::Mailers::Helpers
include DeviseInvitable::Mailer
default template_path: 'devise/mailer'
def subject_for(key)
return super unless key.to_s == 'invitation_instructions'
I18n.t('devise.mailer.invitation_instructions.subject',
:invited_by => resource.invited_by.try(:firstName) || 'Someone')
end
def self.custom_invitation_instructions(record, opts={})
devise_mail(record, :custom_invitation_instructions, opts)
end
# Clone of the helper method within this class
# def devise_mail(record, action, opts={})
# initialize_from_record(record)
# mail headers_for(action, opts)
# end
end
Thanks in advance for any thoughts.