aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-04-27 12:34:25 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-04-27 12:34:25 -0700
commitab83db9d069dea643eeb3588eeee634a780b6735 (patch)
treeb88a52903ff5e3fefe2a813c21d8da3f36403013 /actionmailer
parentcecafc52ee0a4a53c903ddbaba95683261f88e5f (diff)
downloadrails-ab83db9d069dea643eeb3588eeee634a780b6735.tar.gz
rails-ab83db9d069dea643eeb3588eeee634a780b6735.tar.bz2
rails-ab83db9d069dea643eeb3588eeee634a780b6735.zip
Fixes ActionMailer to work with the ActionView refactoring
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb11
-rw-r--r--actionmailer/test/mail_service_test.rb4
2 files changed, 8 insertions, 7 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 69e77871b0..af2cc2ee24 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -475,7 +475,7 @@ module ActionMailer #:nodoc:
# if @parts.empty?
template_root.find_all_by_parts(@template, {}, template_path).each do |template|
@parts << Part.new(
- :content_type => Mime::Type.lookup_by_extension(template.content_type || "text").to_s,
+ :content_type => template.mime_type ? template.mime_type.to_s : "text/plain",
:disposition => "inline",
:charset => charset,
:body => render_template(template, @body)
@@ -555,12 +555,13 @@ module ActionMailer #:nodoc:
end
def render_template(template, body)
- if template.respond_to?(:content_type)
- @current_template_content_type = template.content_type
+ if template.respond_to?(:mime_type)
+ @current_template_content_type = template.mime_type && template.mime_type.to_sym.to_s
end
@template = initialize_template_class(body)
- layout = _pick_layout(layout, true) unless template.exempt_from_layout?
+ layout = _pick_layout(layout, true) unless
+ ActionController::Base.exempt_from_layout.include?(template.handler)
@template._render_template_with_layout(template, layout, {})
ensure
@current_template_content_type = nil
@@ -584,7 +585,7 @@ module ActionMailer #:nodoc:
end
layout = _pick_layout(layout,
- !template || !template.exempt_from_layout?)
+ !template || ActionController::Base.exempt_from_layout.include?(template.handler))
if template
@template._render_template_with_layout(template, layout, opts)
diff --git a/actionmailer/test/mail_service_test.rb b/actionmailer/test/mail_service_test.rb
index b27bda49be..919ab5de94 100644
--- a/actionmailer/test/mail_service_test.rb
+++ b/actionmailer/test/mail_service_test.rb
@@ -994,13 +994,13 @@ end
class InheritableTemplateRootTest < Test::Unit::TestCase
def test_attr
- expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
+ expected = File.expand_path("#{File.dirname(__FILE__)}/fixtures/path.with.dots")
assert_equal expected, FunkyPathMailer.template_root.to_s
sub = Class.new(FunkyPathMailer)
sub.template_root = 'test/path'
- assert_equal 'test/path', sub.template_root.to_s
+ assert_equal File.expand_path('test/path'), sub.template_root.to_s
assert_equal expected, FunkyPathMailer.template_root.to_s
end
end