Module: Engines::RailsExtensions::ActionMailer

Included in:
ActionMailer::Base
Defined in:
lib/engines/rails_extensions/action_mailer.rb

Overview

The way ActionMailer is coded in terms of finding templates is very restrictive, to the point where all templates for rendering must exist under the single base path. This is difficult to work around without re-coding significant parts of the action mailer code.


The MailTemplates module overrides two (private) methods from ActionMailer to enable mail templates within plugins:

template_path

which now produces the contents of #template_paths

initialize_template_class

which now find the first matching template and creates an ActionVew::Base instance with the correct view_paths

Ideally ActionMailer would use the same template-location logic as ActionView, and the same view paths as ActionController::Base.view_paths, but it currently does not.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



17
18
19
20
21
22
23
24
25
# File 'lib/engines/rails_extensions/action_mailer.rb', line 17

def self.included(base) #:nodoc:
  base.class_eval do
    # TODO commented this out because it seems to break ActionMailer
    # how can this be fixed?
    
    alias_method_chain :template_path, :engine_additions
    alias_method_chain :initialize_template_class, :engine_additions
  end
end