Extract assets paths and make them available to Action Mailer as well
This commit is contained in:
parent
942fe6514c
commit
631dc61885
|
@ -311,6 +311,7 @@ module ActionMailer #:nodoc:
|
|||
include AbstractController::Layouts
|
||||
include AbstractController::Helpers
|
||||
include AbstractController::Translation
|
||||
include AbstractController::AssetPaths
|
||||
|
||||
helper ActionMailer::MailHelper
|
||||
|
||||
|
|
|
@ -13,7 +13,16 @@ module ActionMailer
|
|||
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|
|
||||
|
|
|
@ -20,5 +20,6 @@ module AbstractController
|
|||
autoload :Logger
|
||||
autoload :Rendering
|
||||
autoload :Translation
|
||||
autoload :AssetPaths
|
||||
autoload :ViewPaths
|
||||
end
|
||||
|
|
|
@ -13,6 +13,7 @@ module ActionController
|
|||
MODULES = [
|
||||
AbstractController::Layouts,
|
||||
AbstractController::Translation,
|
||||
AbstractController::AssetPaths,
|
||||
|
||||
Helpers,
|
||||
HideActions,
|
||||
|
@ -67,7 +68,7 @@ module ActionController
|
|||
end
|
||||
|
||||
# TODO Move this to the appropriate module
|
||||
config_accessor :assets_dir, :asset_path, :javascripts_dir, :stylesheets_dir
|
||||
config_accessor :asset_path
|
||||
|
||||
ActiveSupport.run_load_hooks(:action_controller, self)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue