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 uselengthto avoid another db query -
if you haven’t anything loaded, use
countto make a count query on your db -
if you don’t want to bother with these considerations, use
sizewhich will adapt