From 590e41cb99f13c1f36854d4d3507e7c01563d39c Mon Sep 17 00:00:00 2001 From: Igal Koshevoy Date: Fri, 13 May 2011 06:13:27 -0700 Subject: [PATCH] Fix actionmailer patches to correctly handle absolute paths. Newer versions of Rails 2.3.x, like 2.3.10, changed #template_path to return absolute paths for plugin views -- previously these were always relative. This change broke plugins like exception notifiers which contain their own mailer templates. This fix simply checks whether the paths are absolute and only modifies them if they're relative. --- lib/patches/actionmailer_ex.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/patches/actionmailer_ex.rb b/lib/patches/actionmailer_ex.rb index 65bf758..c5f8f2c 100755 --- a/lib/patches/actionmailer_ex.rb +++ b/lib/patches/actionmailer_ex.rb @@ -24,8 +24,12 @@ def create!(method_name, *parameters) #:nodoc: theme_template_roots[path] = ActionView::Base.process_view_paths(File.dirname(path)).first end - tpaths << File.join(RAILS_ROOT, template_path) - theme_template_roots[File.join(RAILS_ROOT, template_path)] = template_root + absolute_template_path = + Pathname.new(template_path).absolute? ? + template_path : + File.join(RAILS_ROOT, template_path) + tpaths << absolute_template_path + theme_template_roots[absolute_template_path] = template_root # If an explicit, textual body has not been set, we check assumptions. unless String === @body @@ -88,4 +92,4 @@ def create!(method_name, *parameters) #:nodoc: @mail = create_mail end end -end \ No newline at end of file +end