ar_mailer
ar_mailer copied to clipboard
Error running ar_sendmail when using Alternate Mail Storage
I set another class in initializer and when ar_sendmail is run I got Unhandled exception undefined method `email_class=' for ActionMailer::Base:Class(NoMethodError):
I'm using adzap-ar_mailer (2.1.8)
What version of Rails?
2.3.5, no easy way to update right now (even to 2.3.6)
Solved! Problem: ar_sendmail.rb 251 begin 252 require 'config/environment' 253 require 'action_mailer/ar_mailer' 254 rescue LoadError
As you can see config/enviroment is loaded before action mailer actually got email_class accessors. You can add
require 'action_mailer/ar_mailer'
to the first line of your initializer so it gets these methods before you use them. Maybe you could update README.
That require actually seems unnecessary as the gem/plugin should be loaded already after the environment loads. So I am not sure why this can't work without requiring ar_mailer at all.
yes, it's strange when I run irb in rails app root and run require 'config/environment.rb' ActionMailer::Base.email_class = QueuedEmailMessage everything seems to work
I don't see why but that require helped. Are you able to reproduce this problem (e.g. on newer version of rails)