4 ms·
I think there was a talk by David Heinemeier Hansson where he talks about this. I believe it's mainly put in to annoy someone.
by mrweasel 12y ago
I think there was a talk by David Heinemeier Hansson where he talks about this. I believe it's mainly put in to annoy someone.
- mbesto 12y agoHaha. Genuine question - why are nth methods available in ActiveRecord? Basically anything past .first doesn't seem necessary (functionally speaking).
- mrweasel 12y agoI don't know, I'm not a Ruby/Rails guy. I just remember seeing something where DHH talked about this.
- mackwic 12y agoIt's the whole philosophy of ruby: sometimes, it makes more sense to write the index in full letters rather than in digits.
- briandear 12y agoI feel the same way about empty parenthesis and line ending semicolons. Lol.
- ghayes 12y agoFor 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.
- briandear 12y agoThis was put in as a result of a folks complaining about .second and similar array sugar. I don't have the link to the Github thread from 8 years ago, but I remember it was prodigiously awesome.