Forum: Ruby on Rails How to extend ActionMailer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-05-06 21:04
I wish to extend ActionMailer::Base by method chaining a class instance
variable:

module ActionMailer
  class Base
    class << self
      def method_name
       ...

What is the magic incantation to accomplish this?

I cannot get this to work with action mailer:

module MyMethods

  def self.include(base)
    base.alias_method_chain  :method_name,  :my_method

  def method_name_with_my_method
    ... stuff
    method_name_without_my_method
  end
...
end

class ActionMailer::Base
  include MyMethods
end

require 'my_methods'
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-05-06 21:19
James Byrne wrote:
> I wish to extend ActionMailer::Base by method chaining a class instance
> variable:

I was ever so close:

class ActionMailer::Base

  class << self

    def self.include(base)

       base.alias_method_chain  :method_name,  :my_method

       def method_name_with_my_method
         ...
         method_name_without_my_method
       end
    end
  end
end
This topic is locked and can not be replied to.