Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8166

Show
Ignore:
Timestamp:
11/18/07 22:01:33 (1 year ago)
Author:
david
Message:

Fixed that partial rendering should look at the type of the first render to determine its own type if no other clues are available (like when using text.plain.erb as the extension in AM) (closes #10130) [java] Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionmailer/CHANGELOG

    r8114 r8166  
    11*SVN* 
     2 
     3* Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java] 
    24 
    35* Update README to use new smtp settings configuration API. Closes #10060 [psq] 
  • trunk/actionmailer/test/mail_render_test.rb

    r8111 r8166  
    1919    recipients recipient 
    2020    subject    "rendering rxml template" 
     21    from       "tester@example.com" 
     22  end 
     23   
     24  def included_subtemplate(recipient) 
     25    recipients recipient 
     26    subject    "Including another template in the one being rendered" 
    2127    from       "tester@example.com" 
    2228  end 
     
    7177    assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip 
    7278  end 
     79   
     80  def test_included_subtemplate 
     81    mail = RenderMailer.deliver_included_subtemplate(@recipient) 
     82    assert_equal "Hey Ho, let's go!", mail.body.strip 
     83  end 
    7384end 
    7485 
  • trunk/actionpack/CHANGELOG

    r8130 r8166  
    11*SVN* 
     2 
     3* Fixed that partial rendering should look at the type of the first render to determine its own type if no other clues are available (like when using text.plain.erb as the extension in AM) #10130 [java] 
    24 
    35* Fixed that has_many :through associations should render as collections too #9051 [mathie/danger] 
  • trunk/actionpack/lib/action_view/base.rb

    r8134 r8166  
    288288          end 
    289289          template_file_name = full_template_path(template_path, template_extension) 
    290           template_extension = template_extension.gsub(/^\w+\./, '') # strip off any formats 
     290          template_extension = template_extension.gsub(/^.+\./, '') # strip off any formats 
    291291        end 
    292292      else 
     
    491491      # Determines the template's file extension, such as rhtml, rxml, or rjs. 
    492492      def find_template_extension_for(template_path) 
    493         find_template_extension_from_handler(template_path, true) || find_template_extension_from_handler(template_path) 
     493        find_template_extension_from_handler(template_path, true) || 
     494        find_template_extension_from_handler(template_path) || 
     495        find_template_extension_from_first_render() 
    494496      end 
    495497 
     
    512514        nil 
    513515      end 
     516       
     517      # Determine the template extension from the <tt>@first_render</tt> filename 
     518      def find_template_extension_from_first_render 
     519        extension = @first_render.to_s.sub /^\w+\.?/, '' 
     520        extension.blank? ? nil : extension 
     521      end 
    514522 
    515523      # This method reads a template file.