There has been an astounding amount of invective and discussion over a recent addition to Rails. Briefly, if you have an array in Rails, you can now use ordinal numbers to get at the first ten members through aliases such as Array#second, Array#third, and so on. Some people are concerned about code bloat, some are concerned about lack of elegance, and DHH's judgment in writing this bit of code has been seriously challenged.

Well, I'm not happy either - because the changes don't go far enough. Let's add one more method to Array and be done with it:

[sourcecode language='ruby']
Class Array
def by_ordinal(pos)
self[pos.to_i - 1]
end
end
[/sourcecode]

With this simple addition, you can refer to Array.by_ordinal("3rd"), Array.by_ordinal("21st"), or even Array.by_ordinal("407th"). As a bonus, the naming of the individual members is consistent with Rails' Inflector#ordinalize method. Please join me in pushing for this to be included in Rails core.