how can I change the Devise::Mailer?

230 views
Skip to first unread message

roguecartel

unread,
Mar 30, 2011, 9:54:58 PM3/30/11
to Devise
I am using PostageApp which has its own mailer as a sub-class of
ActionMailer....so, for example, when I hand-roll my owner UserMailer
I have it UserMailer << PostageApp::Mailer.

How can I have Devise's Mailer use PostageApp?

Carlos Antonio da Silva

unread,
Mar 30, 2011, 10:13:47 PM3/30/11
to plataforma...@googlegroups.com, roguecartel
Just configure it: https://github.com/plataformatec/devise/blob/master/lib/generators/templates/devise.rb#L8

The problem is that you'll have to copy the entire DeviseMailer code, as you can't share both :).
It'd be great if PostageApp allowed you to just include it as a module in DeviseMailer.
--
At.
Carlos A. da Silva

roguecartel

unread,
Apr 28, 2011, 5:00:55 PM4/28/11
to Devise
Hi, Carlos --

I created a mailer also called devise_mailer.rb but put it into the
mailer directory...will it know to look there for an override?

On Mar 30, 7:13 pm, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> Just configure it:https://github.com/plataformatec/devise/blob/master/lib/generators/te...
>
> The problem is that you'll have to copy the entire DeviseMailer code, as you
> can't share both :).
> It'd be great if PostageApp allowed you to just include it as a module in
> DeviseMailer.
>

Carlos Antonio da Silva

unread,
Apr 28, 2011, 5:04:58 PM4/28/11
to plataforma...@googlegroups.com
Probably, but remember newer devise versions use Devise::Mailer, so you have to use devise/mailer.rb
I've never done that this way, you're overriding the entire mailer, but I think it should work.

Benjamin Orozco

unread,
May 6, 2011, 4:26:21 PM5/6/11
to plataforma...@googlegroups.com
I have the same issue. I'm using Devise 1.0.11 and Rails 2.3.10. Is it possible to override the whole devise_mailer.rb, or only the methods that are required? or should I edit the devise_mailer.rb directly? I'm a little confused. Any help appreciated.

Benjamin Orozco

unread,
May 10, 2011, 6:03:08 PM5/10/11
to plataforma...@googlegroups.com

roguecartel

unread,
May 27, 2011, 12:45:03 AM5/27/11
to plataforma...@googlegroups.com
Hi, so to restate for my own clarity: you copied it from the gem and put it into the app model and then changed the header and devise knew to use that rather than the gem?

class DeviseMailer < PostageApp::Mailer
Reply all
Reply to author
Forward
0 new messages