You should read that, it’s still valid.
You’ll adapt the function you use depending on your needs.
Basically:
-
if you already load all entries, say
User.all
, then you should uselength
to avoid another db query -
if you haven’t anything loaded, use
count
to make a count query on your db -
if you don’t want to bother with these considerations, use
size
which will adapt