How can I change out how a gem uses ActionMailer and substitute a different mailer class?
I am using a gem (Devise) that relies on the ActionMailer:
https://github.com/plataformatec/devise/blob/master/app/mailers/devise/mailer.rb#L5-15
I want it to use PostageApp:Mailer instead of ActionMailer. But we don't know how to make that change since it is inside of a gem. We don't want to break the gem 开发者_C百科so is there a way to make the change from within our app by using a library?
I had to override the whole mailer class: http://help.postageapp.com/discussions/support/176-how-can-i-make-the-devisemailer-a-subclass-of-postageapp
This person believes that all you may need to do is implement the same methods as ActionMailer, and it may work: http://groups.google.com/group/plataformatec-devise/browse_thread/thread/e048dd5d9a0d1d5f/70f02d5bd67f1271
More here: https://github.com/plataformatec/devise/blob/master/app/mailers/devise/mailer.rb#L5-15
精彩评论