Override Devise::Mailer

1,243 views
Skip to first unread message

patrick_connor

unread,
Apr 11, 2011, 10:40:19 AM4/11/11
to Devise
I am trying to customize the devise mailer (to allow for including
dynamic data in the subject line).

In devise.rb I have tried a number of alternatives to change
'config.mailer', but all result in an Action Controller Exception -
'wrong constant name /app/mailers/devise_mailer.rb'.

My new mailer is located at 'app/mailers/new_mailer.rb'

I have tried (and restarted the server each time):
config.mailer = "/app/mailers/new_mailer.rb"
config.mailer = "app/mailers/new_mailer.rb"
config.mailer = "/mailers/new_mailer.rb"
config.mailer = "mailers/new_mailer.rb"
config.mailer = "/new_mailer.rb"
config.mailer = "new_mailer.rb"

All produce an error similar to the one above. I am sure this is
simple enough to do, but I cannot find it documented anywhere.

Thanks in advance!

Carlos Antonio da Silva

unread,
Apr 11, 2011, 12:15:22 PM4/11/11
to plataforma...@googlegroups.com, patrick_connor
From the docs:


  # Configure the class responsible to send e-mails.
  # config.mailer = "Devise::Mailer"

So you should put the mailer class name in the config.mailer config: In your case I believe it'd be just "NewMailer".
--
At.
Carlos A. da Silva

patrick_connor

unread,
Apr 11, 2011, 12:29:06 PM4/11/11
to Devise
Carlos,

Your suggestion does, of course, work perfectly!

Someday I will learn to trust rails and start working from the most
simple solution up instead of the most contrived solution down!

THANK YOU!


On Apr 11, 11:15 am, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> From the docs:
>
>   # Configure the class responsible to send e-mails.
>
>   # config.mailer = "Devise::Mailer"
>
> So you should put the mailer class name in the config.mailer config: In your
> case I believe it'd be just "NewMailer".
>

Carlos Antonio da Silva

unread,
Apr 11, 2011, 12:32:01 PM4/11/11
to plataforma...@googlegroups.com, patrick_connor
Good to know it's working. Thanks.
Reply all
Reply to author
Forward
0 new messages