Changeset 8212
- Timestamp:
- 11/26/07 03:36:28 (1 year ago)
- Files:
-
- trunk/actionmailer/CHANGELOG (modified) (1 diff)
- trunk/actionmailer/lib/action_mailer/base.rb (modified) (4 diffs)
- trunk/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb (moved) (moved from trunk/actionmailer/test/fixtures/test_mailer/subtemplate.text.plain.erb)
- trunk/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb (modified) (1 diff)
- trunk/actionmailer/test/mail_render_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionmailer/CHANGELOG
r8166 r8212 1 1 *SVN* 2 3 * Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [rick] 4 5 * Pass the template_root as an array as ActionView's view_path 6 * Request templates with the "#{mailer_name}/#{action}" as opposed to just "#{action}" 2 7 3 8 * Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java] trunk/actionmailer/lib/action_mailer/base.rb
r8111 r8212 299 299 adv_attr_accessor :implicit_parts_order 300 300 301 # Override the mailer name, which defaults to an inflected version of the302 # mailer's class name. If you want to use a template in a non-standard303 # location, you can use this to specify that location.304 adv_attr_accessor :mailer_name305 306 301 # Defaults to "1.0", but may be explicitly given if needed. 307 302 adv_attr_accessor :mime_version … … 323 318 adv_attr_accessor :template 324 319 320 # Override the mailer name, which defaults to an inflected version of the 321 # mailer's class name. If you want to use a template in a non-standard 322 # location, you can use this to specify that location. 323 def mailer_name(value = nil) 324 if value 325 self.mailer_name = value 326 else 327 self.class.mailer_name 328 end 329 end 330 331 def mailer_name=(value) 332 self.class.mailer_name = value 333 end 334 325 335 # The mail object instance referenced by this mailer. 326 336 attr_reader :mail 327 337 328 338 class << self 339 attr_writer :mailer_name 340 341 def mailer_name 342 @mailer_name ||= name.underscore 343 end 344 345 # for ActionView compatibility 346 alias_method :controller_name, :mailer_name 347 alias_method :controller_path, :mailer_name 348 329 349 def method_missing(method_symbol, *parameters)#:nodoc: 330 350 case method_symbol.id2name … … 477 497 def render(opts) 478 498 body = opts.delete(:body) 499 if opts[:file] && opts[:file] !~ /\// 500 opts[:file] = "#{mailer_name}/#{opts[:file]}" 501 end 479 502 initialize_template_class(body).render(opts) 480 503 end … … 485 508 486 509 def initialize_template_class(assigns) 487 ActionView::Base.new( template_path, assigns, self)510 ActionView::Base.new([template_root], assigns, self) 488 511 end 489 512 trunk/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb
r8188 r8212 1 Hey Ho, <%= render "subtemplate" %>1 Hey Ho, <%= render :partial => "subtemplate" %> trunk/actionmailer/test/mail_render_test.rb
r8166 r8212 26 26 subject "Including another template in the one being rendered" 27 27 from "tester@example.com" 28 end 29 30 def included_old_subtemplate(recipient) 31 recipients recipient 32 subject "Including another template in the one being rendered" 33 from "tester@example.com" 34 body render(:inline => "Hello, <%= render \"subtemplate\" %>", :body => { :world => "Earth" }) 28 35 end 29 36 … … 82 89 assert_equal "Hey Ho, let's go!", mail.body.strip 83 90 end 91 92 def test_deprecated_old_subtemplate 93 assert_raises ActionView::ActionViewError do 94 RenderMailer.deliver_included_old_subtemplate(@recipient) 95 end 96 end 84 97 end 85 98