Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Fix actionmailer patches to correctly handle absolute paths.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
igal committed May 13, 2011
1 parent 6b7f9f0 commit 590e41c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/patches/actionmailer_ex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -88,4 +92,4 @@ def create!(method_name, *parameters) #:nodoc:
@mail = create_mail
end
end
end
end

0 comments on commit 590e41c

Please sign in to comment.