Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

Error running ar_sendmail when using Alternate Mail Storage #6

Open
ares opened this issue Jul 27, 2010 · 6 comments
Open

Error running ar_sendmail when using Alternate Mail Storage #6

ares opened this issue Jul 27, 2010 · 6 comments

Comments

@ares
Copy link

ares commented Jul 27, 2010

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):

@ares
Copy link
Author

ares commented Jul 27, 2010

I'm using adzap-ar_mailer (2.1.8)

@adzap
Copy link
Owner

adzap commented Jul 27, 2010

What version of Rails?

@ares
Copy link
Author

ares commented Jul 28, 2010

2.3.5, no easy way to update right now (even to 2.3.6)

@ares
Copy link
Author

ares commented Jul 28, 2010

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.

@adzap
Copy link
Owner

adzap commented Jul 28, 2010

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.

@ares
Copy link
Author

ares commented Jul 29, 2010

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants