I was writing an ActionMailer using the 2.0 Preview (all this applies to Edge as well). Since my mails were sent as text/plain, I named my template order_confirmation.text.plain.erb like suggested in the documentation.
(I don't know exactly where I read this, the rails documentation is currently lacking a clear and strong opinion on the issue of naming your templates. .rhtml is deprecated but that isn't made clear in the docs and how to properly name the files now is not written down anywhere too, but that's stuff for another ticket)
All went well until I created a second template and a common subtemplate that I rendered with
<%= render "cart" %>
Rails couldn't find the subtemplate since no extension was provided.
In such a case ActionView looks into the controller for a Content-Type but since this was ActionMailer, none was found (although ActionMailer does provide that information, just not in #request.parameters[:format], but in #content_type). To fix this I extended ActionView::Base#find_template_extension_for to determine the extension for the subtemplate based on the extension of the @first_render template.
So, if a subtemplate is rendered and no template_format is given, ActionView now assumes the same extension as in the "main" template (@first_render). Doing this revealed an additional bug in ActionView::Base#render_file:
template_extension = template_extension.gsub(/^\w+\./, '')
had to be changed to
template_extension = template_extension.gsub(/^\.+\./, '')
otherwise a text.plain.erb extension would only be stripped to plain.erb and compiling the template wouldn' work.
I have attached two patches, one containing the tests revealing the problem, the other containing the solution.