Re:Rails – #forty_two() method
by mbesto on Monday November 10, 2014 @02:58AM
(#8582463)
Haha. Genuine question - why are nth methods available in ActiveRecord? Basically anything past .first doesn't seem necessary (functionally speaking).
[ Parent
| on HN ]
For me, it comes up in test cases. In a controlled environment, it can be nice to mentally say "add two objects, the first should be this, the second should be this." I don't think I've ever used `second` outside of the testing realm.
It's the whole philosophy of ruby: sometimes, it makes more sense to write the index in full letters rather than in digits.
I don't know, I'm not a Ruby/Rails guy. I just remember seeing something where DHH talked about this.