<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>actionmailer/lib/action_mailer/deprecated_body.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -32,6 +32,7 @@ module ActionMailer
   end
 
   autoload :AdvAttrAccessor, 'action_mailer/adv_attr_accessor'
+  autoload :DeprecatedBody, 'action_mailer/deprecated_body'
   autoload :Base, 'action_mailer/base'
   autoload :DeliveryMethod, 'action_mailer/delivery_method'
   autoload :Part, 'action_mailer/part'</diff>
      <filename>actionmailer/lib/action_mailer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -263,6 +263,8 @@ module ActionMailer #:nodoc:
       include ActionController::UrlWriter
     end
 
+    include ActionMailer::DeprecatedBody
+
     private_class_method :new #:nodoc:
 
     class_inheritable_accessor :view_paths
@@ -304,16 +306,11 @@ module ActionMailer #:nodoc:
     cattr_accessor :default_implicit_parts_order
 
     cattr_reader :protected_instance_variables
-    @@protected_instance_variables = %w(@body)
+    @@protected_instance_variables = []
 
     # Specify the BCC addresses for the message
     adv_attr_accessor :bcc
 
-    # Define the body of the message. This is either a Hash (in which case it
-    # specifies the variables to pass to the template when it is rendered),
-    # or a string, in which case it specifies the actual text of the message.
-    adv_attr_accessor :body
-
     # Specify the CC addresses for the message.
     adv_attr_accessor :cc
 
@@ -358,33 +355,27 @@ module ActionMailer #:nodoc:
     # have multiple mailer methods share the same template.
     adv_attr_accessor :template
 
+    # The mail and action_name instances referenced by this mailer.
+    attr_reader :mail, :action_name
+
+    # Where the response body is stored.
+    attr_internal :response_body
+
     # Override the mailer name, which defaults to an inflected version of the
     # mailer's class name. If you want to use a template in a non-standard
     # location, you can use this to specify that location.
+    attr_writer :mailer_name
+
     def mailer_name(value = nil)
       if value
-        self.mailer_name = value
+        @mailer_name = value
       else
-        self.class.mailer_name
+        @mailer_name || self.class.mailer_name
       end
     end
 
-    def mailer_name=(value)
-      self.class.mailer_name = value
-    end
-
-    # The mail object instance referenced by this mailer.
-    attr_reader :mail
-    attr_reader :template_name, :default_template_name, :action_name
-    attr_internal :response_body
-
-    def controller_path
-      self.class.controller_path
-    end
-
-    def formats
-      [:&quot;*/*&quot;]
-    end
+    # Alias controller_path to mailer_name so render :partial in views work.
+    alias :controller_path :mailer_name
 
     class &lt;&lt; self
       attr_writer :mailer_name
@@ -393,10 +384,6 @@ module ActionMailer #:nodoc:
         @mailer_name ||= name.underscore
       end
 
-      # for ActionView compatibility
-      alias_method :controller_name, :mailer_name
-      alias_method :controller_path, :mailer_name
-
       def respond_to?(method_symbol, include_private = false) #:nodoc:
         matches_dynamic_method?(method_symbol) || super
       end
@@ -472,58 +459,8 @@ module ActionMailer #:nodoc:
       initialize_defaults(method_name)
       __send__(method_name, *parameters)
 
-      # Check if render was called.
-      @body = self.response_body if @body.is_a?(Hash) &amp;&amp; @body.empty?
-
-      # If an explicit, textual body has not been set, we check assumptions.
-      unless String === @body
-        # TODO Fix me. Deprecate assigns to be given as a :body hash
-        if @body.is_a?(Hash)
-          @body.each do |k, v|
-            instance_variable_set(:&quot;@#{k}&quot;, v)
-          end
-        end
-
-        # First, we look to see if there are any likely templates that match,
-        # which include the content-type in their file name (i.e.,
-        # &quot;the_template_file.text.html.erb&quot;, etc.). Only do this if parts
-        # have not already been specified manually.
-        # if @parts.empty?
-          template_root.find_all(@template, {}, template_path).each do |template|
-            @parts &lt;&lt; Part.new(
-              :content_type =&gt; template.mime_type ? template.mime_type.to_s : &quot;text/plain&quot;,
-              :disposition =&gt; &quot;inline&quot;,
-              :charset =&gt; charset,
-              :body =&gt; render_to_body(:_template =&gt; template)
-            )
-          end
-
-          if @parts.size &gt; 1
-            @content_type = &quot;multipart/alternative&quot; if @content_type !~ /^multipart/
-            @parts = sort_parts(@parts, @implicit_parts_order)
-          end
-        # end
-
-        # Then, if there were such templates, we check to see if we ought to
-        # also render a &quot;normal&quot; template (without the content type). If a
-        # normal template exists (or if there were no implicit parts) we render
-        # it.
-        # ====
-        # TODO: Revisit this
-        # template_exists = @parts.empty?
-        # template_exists ||= template_root.find(&quot;#{mailer_name}/#{@template}&quot;)
-        # @body = render_message(@template, @body) if template_exists
-
-        # Finally, if there are other message parts and a textual body exists,
-        # we shift it onto the front of the parts and set the body to nil (so
-        # that create_mail doesn't try to render it in addition to the parts).
-        # ====
-        # TODO: Revisit this
-        # if !@parts.empty? &amp;&amp; String === @body
-        #   @parts.unshift Part.new(:charset =&gt; charset, :body =&gt; @body)
-        #   @body = nil
-        # end
-      end
+      # Create e-mail parts
+      create_parts
 
       # If this is a multipart e-mail add the mime_version if it is not
       # already set.
@@ -556,6 +493,7 @@ module ActionMailer #:nodoc:
     end
 
     private
+
       # Set up the default values for the various instance variables of this
       # mailer. Subclasses may override this method to provide different
       # defaults.
@@ -568,38 +506,42 @@ module ActionMailer #:nodoc:
         @mailer_name ||= self.class.name.underscore
         @parts ||= []
         @headers ||= {}
-        @body ||= {}
         @mime_version = @@default_mime_version.dup if @@default_mime_version
         @sent_on ||= Time.now
-      end
 
-      def render(*args)
-        # TODO Fix me. Deprecate assigns to be given as a :body hash
-        options = args.last.is_a?(Hash) ? args.last : {}
-        if options[:body]
-          options.delete(:body).each do |k, v|
-            instance_variable_set(:&quot;@#{k}&quot;, v)
-          end
-        end
-
-        super
+        super # Run deprecation hooks
       end
 
-      def template_root
-        self.class.template_root
-      end
+      def create_parts
+        super # Run deprecation hooks
 
-      def template_root=(root)
-        self.class.template_root = root
-      end
+        if String === response_body
+          @parts.unshift Part.new(
+            :content_type =&gt; &quot;text/plain&quot;,
+            :disposition =&gt; &quot;inline&quot;,
+            :charset =&gt; charset,
+            :body =&gt; response_body
+          )
+        else
+          self.class.template_root.find_all(@template, {}, mailer_name).each do |template|
+            @parts &lt;&lt; Part.new(
+              :content_type =&gt; template.mime_type ? template.mime_type.to_s : &quot;text/plain&quot;,
+              :disposition =&gt; &quot;inline&quot;,
+              :charset =&gt; charset,
+              :body =&gt; render_to_body(:_template =&gt; template)
+            )
+          end
 
-      def template_path
-        &quot;#{mailer_name}&quot;
+          if @parts.size &gt; 1
+            @content_type = &quot;multipart/alternative&quot; if @content_type !~ /^multipart/
+            @parts = sort_parts(@parts, @implicit_parts_order)
+          end
+        end
       end
 
       def sort_parts(parts, order = [])
         order = order.collect { |s| s.downcase }
-        
+
         parts = parts.sort do |a, b|
           a_ct = a.content_type.downcase
           b_ct = b.content_type.downcase
@@ -648,14 +590,6 @@ module ActionMailer #:nodoc:
           m.set_content_type(real_content_type, nil, ctype_attrs)
           m.body = normalize_new_lines(@parts.first.body)
         else
-          if String === body
-            part = TMail::Mail.new
-            part.body = normalize_new_lines(body)
-            part.set_content_type(real_content_type, nil, ctype_attrs)
-            part.set_content_disposition &quot;inline&quot;
-            m.parts &lt;&lt; part
-          end
-
           @parts.each do |p|
             part = (TMail::Mail === p ? p : p.to_mail(self))
             m.parts &lt;&lt; part</diff>
      <filename>actionmailer/lib/action_mailer/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,5 @@
 # encoding: utf-8
 require 'abstract_unit'
-require 'active_support/testing/pending'
 
 class FunkyPathMailer &lt; ActionMailer::Base
   self.template_root = &quot;#{File.dirname(__FILE__)}/fixtures/path.with.dots&quot;
@@ -291,7 +290,6 @@ end
 
 class ActionMailerTest &lt; Test::Unit::TestCase
   include ActionMailer::Quoting
-  include ActiveSupport::Testing::Pending
 
   def encode( text, charset=&quot;utf-8&quot; )
     quoted_printable( text, charset )
@@ -979,10 +977,8 @@ EOF
   end
 
   def test_body_is_stored_as_an_ivar
-    pending &quot;needs attr_internal on @body&quot; do
-      mail = TestMailer.create_body_ivar(@recipient)
-      assert_equal &quot;body: foo\nbar: baz&quot;, mail.body
-    end
+    mail = TestMailer.create_body_ivar(@recipient)
+    assert_equal &quot;body: foo\nbar: baz&quot;, mail.body
   end
 
   def test_starttls_is_enabled_if_supported</diff>
      <filename>actionmailer/test/mail_service_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>03960048616593c249745d1e321dbcc7f0483c76</id>
    </parent>
  </parents>
  <author>
    <name>Jos&#233; Valim</name>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/feldpost/rails/commit/418c3f801cd436f011b37fe69059073e69e05084</url>
  <id>418c3f801cd436f011b37fe69059073e69e05084</id>
  <committed-date>2009-10-31T18:23:48-07:00</committed-date>
  <authored-date>2009-10-21T16:05:55-07:00</authored-date>
  <message>Another refactoring on AM. body is deprecated, use render instead.</message>
  <tree>6ae84921892f4ee1f056c2f2338f390c795f7325</tree>
  <committer>
    <name>Yehuda Katz</name>
    <email>wycats@gmail.com</email>
  </committer>
</commit>
