What have you found for these years?

2010-04-27

daily WTF, Rails!?

Why on earth Mailer.new returns nil???
I thought no matter what happened, new should never
return nil, even there's not enough memory!!
In that case, it should raise exception.

Use the source? it tells you nothing about new.

And I see below on the doc:

ApplicationMailer.create_signed_up("david@loudthinking.com") # => tmail object for testing
ApplicationMailer.deliver_signed_up("david@loudthinking.com") # sends the email
ApplicationMailer.new.signed_up("david@loudthinking.com") # won't work!

I didn't notice the # won't work! comment at all!!!!
Yes that who me didn't read it carefully...
but that's a common sense you put all use cases,
and new is very straightforward, isn't it??

Why not just undefine new if you don't want people to call it?
Then at least I can see no new method error,
instead of giving a nil which means nothing at all.

Start whining/ranting again lol...

0 retries:

Post a Comment

Note: Only a member of this blog may post a comment.



All texts are licensed under CC Attribution 3.0