Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract assets paths and make them available to Action Mailer as well

  • Loading branch information...
commit 631dc618853325e5780237388224cb785a3a1b82 1 parent 942fe65
@dhh dhh authored
View
1  actionmailer/lib/action_mailer/base.rb
@@ -311,6 +311,7 @@ class Base < AbstractController::Base
include AbstractController::Layouts
include AbstractController::Helpers
include AbstractController::Translation
+ include AbstractController::AssetPaths
helper ActionMailer::MailHelper
View
9 actionmailer/lib/action_mailer/railtie.rb
@@ -13,7 +13,16 @@ class Railtie < Rails::Railtie
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|
View
1  actionpack/lib/abstract_controller.rb
@@ -20,5 +20,6 @@ module AbstractController
autoload :Logger
autoload :Rendering
autoload :Translation
+ autoload :AssetPaths
autoload :ViewPaths
end
View
3  actionpack/lib/action_controller/base.rb
@@ -13,6 +13,7 @@ def self.without_modules(*modules)
MODULES = [
AbstractController::Layouts,
AbstractController::Translation,
+ AbstractController::AssetPaths,
Helpers,
HideActions,
@@ -67,7 +68,7 @@ def self.subclasses
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
Please sign in to comment.
Something went wrong with that request. Please try again.