I'm not sure I understand the new API though. You define instance
methods but call class methods? Also, what's that magic recipient
parameter we never pass in? Why not just define class methods? Eg:
class Notifier < ActionMailer::Base
delivers_from("system@example.com")
I'm not sure I understand the new API though. You define instance
methods but call class methods? Also, what's that magic recipient
parameter we never pass in? Why not just define class methods? Eg:
Class methods won't work unfortunately, this is because you can't play
with instance variables or call other instance methods (like headers
or attachments)
I am not sure what the magic recipient parameter is we never pass in.
If you are talking about the old API doing:
I think he means in your blog post, you have samples like this:
Notifier.signup_notification.deliver
Ie. calling the signup_notification class method with no arguments. And yet what you showed defined in the Notifier class was an instance method expecting a parameter that you've named recipient in your examples:
def signup_notification(recipient)
I was wondering the same thing, where is that recipient argument coming from?
Just letting you know we have a new DSL for Action Mailer.
I think removing the magic #deliver_* and #create_* methods, and
returning an actual Mail object directly by an existing method makes a
lot of sense.
On the other hand, I think replacing methods like #body, #subject,
etc. with a hash is a missed idea, it's harder to write and read, and
less clear to grasp, especially when you notice that ActiveRecord API
changes in exactly the opposite direction (from :conditions =>
conditions to #where(conditions), etc.).
Are there any more improvements planned on this or is that the final
version?