Permalink
Browse files

Add deprecation for old subtemplate syntax for ActionMailer templates…

…, use render :partial [rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8211 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8afb4e1 commit 3d67860cae0898b248381075d98736ff77d671dd @technoweenie technoweenie committed Nov 26, 2007
Showing with 15 additions and 0 deletions.
  1. +2 −0 actionpack/CHANGELOG
  2. +13 −0 actionpack/lib/action_view/base.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Add deprecation for old subtemplate syntax for ActionMailer templates, use render :partial [rick]
+
* Fix TemplateError so it doesn't bomb on exceptions while running tests [rick]
* Fixed that named routes living under resources shouldn't have double slashes #10198 [isaacfeliu]
@@ -276,6 +276,19 @@ def initialize(view_paths = [], assigns_for_first_render = {}, controller = nil)
# it's relative to the view_paths array, otherwise it's absolute. The hash in <tt>local_assigns</tt>
# is made available as local variables.
def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
+ if defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) && !template_path.include?("/")
+ raise ActionViewError, <<-END_ERROR
+Due to changes in ActionMailer, you need to provide the mailer_name along with the template name.
+
+ render "user_mailer/signup"
+ render :file => "user_mailer/signup"
+
+If you are rendering a subtemplate, you must now use controller-like partial syntax:
+
+ render :partial => 'signup' # no mailer_name necessary
+ END_ERROR
+ end
+
@first_render ||= template_path
template_path_without_extension, template_extension = path_and_extension(template_path)
if use_full_path

0 comments on commit 3d67860

Please sign in to comment.