You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm on rails 3.0.5. ActionMailer::Base has an internal attribute created with the name 'message', and this fact is not documented. If you happen to try to define a delivery method called 'message' on one of your mailers, fun things happen. It is documented that there is a message object available to a mailer view. However, I do not think of the view and controller as being the exact same context (though they share instance vars), so it did not occur to me that I am not allowed to 'def message' inside a mailer.
Steps to reproduce:
create a new mailer
define two delivery methods, call one of them 'message'. Make it accept an argument or three for extra confusion.
Try to send an email with the method that isn't called 'message'.
Imported from Lighthouse.
Comment by ifesdjeen - 2011-03-19 10:44:44 UTC
It's not a direct part of ActionMailer::Base. It's more a part of MailHelper (actionmailer/lib/action_mailer/mail_helper.rb).
It's an accessor to @_message instance variable.
Naming things is one of the biggest problems, actually :) If you say it's a delivery method, you should probably call it "deliver_message" and the other one would become "deliver reply".
So, having message method is completely legitimate in that particular case. If you want to change a message accessor itself, feel free to override it.
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6584
Created by andrew.hay.kurtz (at gmail) - 2011-03-15 17:58:10 UTC
I'm on rails 3.0.5. ActionMailer::Base has an internal attribute created with the name 'message', and this fact is not documented. If you happen to try to define a delivery method called 'message' on one of your mailers, fun things happen. It is documented that there is a message object available to a mailer view. However, I do not think of the view and controller as being the exact same context (though they share instance vars), so it did not occur to me that I am not allowed to 'def message' inside a mailer.
Steps to reproduce:
Gist of my mailer:
https://gist.github.com/871136
Gist of exception from my rspec test:
https://gist.github.com/871143
Thanks a lot!
The text was updated successfully, but these errors were encountered: