
Rails – #forty_two() method - MrBra
http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html#method-i-forty_two
======
mrweasel
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
Haha. Genuine question - why are nth methods available in ActiveRecord?
Basically anything past .first doesn't seem necessary (functionally speaking).

~~~
ghayes
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.

------
cookrn
Fun! This can also be found as a general array accessor:

[https://github.com/rails/rails/blob/ed03d4eaa89a7b4ab09e7f5d...](https://github.com/rails/rails/blob/ed03d4eaa89a7b4ab09e7f5da76b522d04650daf/activesupport/lib/active_support/core_ext/array/access.rb#L58-L63)

Here's another interesting one from ActiveSupport giving Ruby Numerics the
ability to be treated as various quantities of bytes:

[https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f6...](https://github.com/rails/rails/blob/9eeb5fed2ff8e781e56202f62b125bfadc486999/activesupport/lib/active_support/core_ext/numeric/bytes.rb)

------
rfw
It seems odd that ActiveRecord even has the methods #first through to
#fifth...

------
bowmessage
Looks like it was merged in on January 20th:
[https://github.com/rails/rails/pull/13757](https://github.com/rails/rails/pull/13757)

------
caniscrator
The answer to life the universe and everything !

~~~
MrBra
pft

------
oldmanjay
I am familiar with this reference!

