More Rails Features

Flashcard 2 of 8

Here's a quick one!

How can we simplify the check we make on this collection?

if users.size > 1
  # Handle multiple users.
end

Small, but useful, many? saves the day:

if users.many?
  # Handle multiple users.
end

This is a pleasant step toward expressive code.

Return to Flashcard Results