Skip to content
This repository
tag: v3.0.13
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 30 lines (23 sloc) 0.89 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
require "action_mailer"
require "rails"

module ActionMailer
  class Railtie < Rails::Railtie
    config.action_mailer = ActiveSupport::OrderedOptions.new

    initializer "action_mailer.logger" do
      ActiveSupport.on_load(:action_mailer) { self.logger ||= Rails.logger }
    end

    initializer "action_mailer.set_configs" do |app|
      paths = app.config.paths
      options = app.config.action_mailer

      options.assets_dir ||= paths.public.to_a.first
      options.javascripts_dir ||= paths.public.javascripts.to_a.first
      options.stylesheets_dir ||= paths.public.stylesheets.to_a.first

      ActiveSupport.on_load(:action_mailer) do
        include app.routes.url_helpers

        register_interceptors(options.delete(:interceptors))
        register_observers(options.delete(:observers))

        options.each { |k,v| send("#{k}=", v) }
      end
    end
  end
end
Something went wrong with that request. Please try again.