2009-12-23 20:01:07 -05:00
|
|
|
require "action_mailer"
|
2009-12-31 15:28:48 -05:00
|
|
|
require "rails"
|
2009-12-23 20:01:07 -05:00
|
|
|
|
|
|
|
module ActionMailer
|
2009-12-31 16:11:54 -05:00
|
|
|
class Railtie < Rails::Railtie
|
2009-12-23 20:01:07 -05:00
|
|
|
plugin_name :action_mailer
|
|
|
|
|
2010-01-13 05:56:11 -05:00
|
|
|
require "action_mailer/railties/subscriber"
|
|
|
|
subscriber ActionMailer::Railties::Subscriber.new
|
|
|
|
|
2009-12-23 20:01:07 -05:00
|
|
|
initializer "action_mailer.set_configs" do |app|
|
|
|
|
app.config.action_mailer.each do |k,v|
|
|
|
|
ActionMailer::Base.send "#{k}=", v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# TODO: ActionController::Base.logger should delegate to its own config.logger
|
|
|
|
initializer "action_mailer.logger" do
|
|
|
|
ActionMailer::Base.logger ||= Rails.logger
|
|
|
|
end
|
|
|
|
|
|
|
|
initializer "action_mailer.view_paths" do |app|
|
|
|
|
# TODO: this should be combined with the logic for default config.action_mailer.view_paths
|
|
|
|
view_path = ActionView::PathSet.type_cast(app.config.view_path, app.config.cache_classes)
|
|
|
|
ActionMailer::Base.template_root = view_path if ActionMailer::Base.view_paths.blank?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|