| ▲ | psadauskas 8 hours ago | |
Fun story about that: In Ruby 2.x, the version GitHub originally launched with, every object implemented the method `id`, which returned the object id (in 3.x, it was renamed to `object_id`). Every object had this id, ActiveRecord models, strings, floats, integers, booleans, etc. Some objects had fixed object ids, like `true.object_id #=> 20`, `false.object_id #=> 0`, `123.object_id #=> 247 (2n+1)`. The `object_id` for `nil` is `4`. Yehuda Katz was the first external user of GitHub after the cofounders, so his github user id is `4`. The way Rails works, if you want to look up a user record, you do it by id:
Now, if there was some bug, and for some reason a comment had no author, `comment.author` would return `nil`, `nil.id` would return `4`, and the UI would show Yehuda as the author in the UI. People would ask, "Who is this Yehuda guy, and why is he commenting on my PRs?" | ||
| ▲ | byroot 5 hours ago | parent | next [-] | |
Similarly, when writing Facebook apps with Rails, when you'd hit that same bug you'd see Mark Zuckerbeg: https://www.facebook.com/profile.php?id=4 | ||
| ▲ | sikozu 6 hours ago | parent | prev | next [-] | |
I love this story, makes me wonder how many other fun bugs on GitHub have been lost to time. | ||
| ▲ | tksb 7 hours ago | parent | prev | next [-] | |
These are the fun anecdotes that make perusing comments here so worth it. Thanks for sharing! | ||
| ▲ | Dragonai 7 hours ago | parent | prev [-] | |
This is too funny. Thanks for sharing this tidbit! | ||