mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
31 lines
No EOL
820 B
Ruby
31 lines
No EOL
820 B
Ruby
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
|
|
am = app.config.action_mailer
|
|
|
|
am.assets_dir ||= paths.public.to_a.first
|
|
am.javascripts_dir ||= paths.public.javascripts.to_a.first
|
|
am.stylesheets_dir ||= paths.public.stylesheets.to_a.first
|
|
|
|
ActiveSupport.on_load(:action_mailer) do
|
|
self.config.merge!(am)
|
|
|
|
include app.routes.url_helpers
|
|
|
|
app.config.action_mailer.each do |k,v|
|
|
send "#{k}=", v
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end |