I got a nasty bug report on a recently
deployed Rails application. The application failed when a user
enters an incorrect user id and clicks on forgot password. What?s weird about this
is the problem did not
happen:
(a) when the user enters invalid user id and clicks on login (gave a good error message)
(b) the exact situation on my development machine has no problem ? again gave correct
error message
What?s going wrong on production?
After scratching my head for a few minutes, it occurred to me the only major difference
is, I am using WebBrick
on my dev machine and Apache on production. After a hunch, going over log files, and
looking over the
code, I discovered that one lonely puts statement that I had inadvertently
left behind in the code!
I had used puts to display some information on WebBrick console and forgot
to get rid of it. This puts didn't
cause any problem on production except in this one particular case. Got the puts removed
and the
application is functioning OK now. Lessons learned from that pesky puts.
Next time, I may use the logger or
put the puts with a condition around. I'm sure there are other better ways I've not
explored. Where's the book...