This project is archived and is in readonly mode.
ActionMailer does not return correctly to respond_to? with deliver_ prefix
Reported by grosser | October 27th, 2009 @ 04:19 PM
require 'actionpack'
=> true
>> ActionMailer::Base.respond_to? 'deliver_sadasda'
NameError: uninitialized constant ActionMailer
from (irb):2
>> require 'actionmailer'
=> true
>> ActionMailer::Base.respond_to? 'deliver_sadasda'
=> #<MatchData "deliver_sadasda" 1:"deliver" 2:"sadasda">
but should be false
Comments and changes to this ticket
-
Cyril Mougel October 27th, 2009 @ 09:43 PM
You right, it's because, ActionMailer::Base.respond_to? check only if this string can be used by ActionMailer. Not if it's implemented.
-
Rohit Arondekar October 6th, 2010 @ 06:36 AM
- State changed from new to stale
- Importance changed from to
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
-
grosser October 6th, 2010 @ 06:51 AM
- Tag changed from 2.3.4, actionmailer, rails to 2.3.9, actionmailer, rails
still here in 2.3.9
AccountMailer.respond_to?(:deliver_xxx) => #<MatchData "deliver_xxx" 1:"deliver" 2:"xxx">
-
grosser October 6th, 2010 @ 06:53 AM
- Title changed from ActionMailer does not return correctly to respond_to? to ActionMailer does not return correctly to respond_to? with deliver_ prefix
-
Rohit Arondekar October 6th, 2010 @ 06:55 AM
- State changed from stale to open
- Assigned user set to Mikel Lindsaar
grosser, can you work on a patch to fix this? Contributor guide: http://rails.lighthouseapp.com/projects/8994/sending-patches
-
David Trasbo October 6th, 2010 @ 08:03 PM
- Assigned user changed from Mikel Lindsaar to José Valim
Here's a patch that applies to
2-3-stable
right now.It doesn't just fix the issue, though. It also greatly simplifies and cleans up the way
ActionMailer::Base.respond_to?
andmethod_missing
works by simply checking if we have afoo
instance method if we doActionMailer::Base.respond_to?(:deliver_foo)
or:create_foo
(which gives us the opportunity to remove a bunch of obsolete tests). -
Jeff Kreeftmeijer October 10th, 2010 @ 08:19 AM
- Tag changed from 2.3.9, actionmailer, rails to 2.3.9, actionmailer, patch, rails
-
David Trasbo October 10th, 2010 @ 04:26 PM
- Assigned user changed from José Valim to Santiago Pastorino
-
Santiago Pastorino October 10th, 2010 @ 05:20 PM
- Assigned user changed from Santiago Pastorino to Mikel Lindsaar
-
David Trasbo October 10th, 2010 @ 05:57 PM
Santiago,
I just want to point out that last time I assigned something to Mikel he didn't see it. Plus, this is not a technical change in terms of email - just a minor architectural change.
-
José Valim October 10th, 2010 @ 06:02 PM
- Assigned user changed from Mikel Lindsaar to José Valim
The ticket was assigned to me, why change it in the first place? Please, have patience that I will apply them when I find some time.
-
David Trasbo October 10th, 2010 @ 06:08 PM
Sorry, José. I can see my intent was unclear, but I just wanted to take some load off your shoulders. You seem to have a lot to do at the moment. Again, sorry.
-
José Valim October 11th, 2010 @ 11:37 PM
- State changed from open to wontfix
Instantiating an Action Mailer just to check if it responds to a given method does not look like a good idea to me, so I cannot apply the given patch. You could use instance_methods or public_instance_methods instead.
This is a bug but I am marking it as won't fix since it is on 2-3-stable branch.
-
David Trasbo October 12th, 2010 @ 03:35 PM
So if I changed the patch to use
instance_methods
instead you wouldn't apply it anyway?
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 5555 actionmailer 2.3.9 should now require 'uri' Same as #3431 - except it's a very minor change. I think ...
- 5555 actionmailer 2.3.9 should now require 'uri' José, same as #3431.