Sha256: 8d052237e7460521f8c07950c6dc0295aaaa9ffaf2f3ed6f106b2274060ef71a

Contents?: true

Size: 1.39 KB

Versions: 28

Compression:

Stored size: 1.39 KB

Contents

require "action_mailer"
require "rails"
require "abstract_controller/railties/routes_helpers"

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"].first
      options.javascripts_dir ||= paths["public/javascripts"].first
      options.stylesheets_dir ||= paths["public/stylesheets"].first

      # make sure readers methods get compiled
      options.asset_path      ||= app.config.asset_path
      options.asset_host      ||= app.config.asset_host

      ActiveSupport.on_load(:action_mailer) do
        include AbstractController::UrlFor
        extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
        include app.routes.mounted_helpers

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

        options.each { |k,v| send("#{k}=", v) }
      end
    end

    initializer "action_mailer.compile_config_methods" do
      ActiveSupport.on_load(:action_mailer) do
        config.compile_methods! if config.respond_to?(:compile_methods!)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
actionmailer-3.1.12 lib/action_mailer/railtie.rb
actionmailer-3.1.11 lib/action_mailer/railtie.rb
actionmailer-3.1.10 lib/action_mailer/railtie.rb
actionmailer-3.1.9 lib/action_mailer/railtie.rb
actionmailer-3.1.8 lib/action_mailer/railtie.rb
actionmailer-3.1.7 lib/action_mailer/railtie.rb
actionmailer-3.1.6 lib/action_mailer/railtie.rb
actionmailer-3.1.5 lib/action_mailer/railtie.rb
actionmailer-3.1.5.rc1 lib/action_mailer/railtie.rb
actionmailer-3.1.4 lib/action_mailer/railtie.rb
actionmailer-3.1.4.rc1 lib/action_mailer/railtie.rb
actionmailer-3.1.3 lib/action_mailer/railtie.rb
actionmailer-3.1.2 lib/action_mailer/railtie.rb
actionmailer-3.1.2.rc2 lib/action_mailer/railtie.rb
actionmailer-3.1.2.rc1 lib/action_mailer/railtie.rb
actionmailer-3.1.1 lib/action_mailer/railtie.rb
actionmailer-3.1.1.rc3 lib/action_mailer/railtie.rb
actionmailer-3.1.1.rc2 lib/action_mailer/railtie.rb
actionmailer-3.1.1.rc1 lib/action_mailer/railtie.rb
actionmailer-3.1.0 lib/action_mailer/railtie.rb