News for hackers. Stuff that matters.
Re:Rails – #forty_two() method by mrweasel on Monday November 10, 2014 @02:50AM (#8582449)
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.
Re:Rails – #forty_two() method by briandear on Monday November 10, 2014 @04:13AM (#8582645)
This 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.
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).
Re:Rails – #forty_two() method by ghayes on Monday November 10, 2014 @03:52PM (#8586311)
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.
Re:Rails – #forty_two() method by mackwic on Monday November 10, 2014 @03:29AM (#8582533)
It's the whole philosophy of ruby: sometimes, it makes more sense to write the index in full letters rather than in digits.
Re:Rails – #forty_two() method by mrweasel on Monday November 10, 2014 @03:11AM (#8582494)
I don't know, I'm not a Ruby/Rails guy. I just remember seeing something where DHH talked about this.
Re:Rails – #forty_two() method by briandear on Monday November 10, 2014 @04:19AM (#8582653)
I feel the same way about empty parenthesis and line ending semicolons. Lol.