Archive for December, 2008

for all of you. Before you enter the New Years Day frenzy, here are the results of last week’s puzzler. (Haven’t been a big secret anyways: every one with a Ruby interpreter could know in the meantime. Yes, that means you!)
What is the output of the following?

~ > irb
>> puts false or 1
false
=> 1
>> puts [...]


…some piece of ruby code that might not behave as you think (depending on your thinking, of course.). Do you know the results?

Note: I finally managed to find the option that allows you to comment on my blog without being logged into wordpress.com. Feel free to comment your findings below.

What is the output of [...]


Everyone seems to know that building an URL from a hash has some speed issues. The reason for that is quite clear: it looks up the shortest route using routes.rb, no wonder that this would take some time.
But how slow is it really? Well, I ran some tests and compared that against building a [...]


Say you are running a bookstore. (Didn’t you know that Rails is all about selling books?). Like everybody else you moved over to an IT infrastructure for managing sales during the last years, and now you have 5000 customers in the database and know about all the books these guys bought at your store – [...]


Oha! Apparently last weeks entry got lost in the publishing chain. So here it is, 8 days after the originally planned publishing date.
These are somewhat random rants, proceed with utmost care!
Inconsistent naming schemes
So, it is called “find(id)” and raises an exception if it doesn’t find the object? When I call it “find_by_id(id)” it doesn’t [...]