1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionmailer/CHANGELOG.md
Yves Senn 23aa94a7b2 mail() without arguments is a getter for the current mail.
This behavior is documented in our guides (http://edgeguides.rubyonrails.org/action_mailer_basics.html#action-mailer-callbacks)
but was broken in the past. This commit short curcuits
the `mail` method if:

  1. mail() was previously called
  2. no headers are passed
  3. no block is passed

Closes #13090.

/cc @pixeltrix
2013-12-02 16:56:31 +01:00

957 B

  • Calling mail() without arguments serves as getter for the current mail message and keeps previously set headers.

    Example:

    class MailerWithCallback < ActionMailer::Base
      after_action :a_callback
    
      def welcome
        mail subject: "subject", to: ["joe@example.com"]
      end
    
      def a_callback
        mail # => returns the current mail message
      end
    end
    

    Yves Senn

  • Instrument the generation of Action Mailer messages. The time it takes to generate a message is written to the log.

    Daniel Schierbeck

  • Invoke mailer defaults as procs only if they are procs, do not convert with to_proc. That an object is convertible to a proc does not mean it's meant to be always used as a proc.

    Fixes #11533.

    Alex Tsukernik

Please check 4-0-stable for previous changes.