Say you are saving two unrelated models at the same time, and you want to validate them before doing so. The following code is usually the first thought:

if (model1.valid? && model2.valid?)
  # Save and redirect
else
  # Render form again to show errors
end

The problem is that if both models are invalid, then we need to show the error messages for both, however the use of AND will mean that only the first of the two components of the if statement will be executed, leaving model2 unchecked. The user will correct the errors shown in model1 and resubmit, but validation will fail on model2, and the form rendered with error messages a second time.

A better solution is to avoid the short-circuit evaluation:

([model1, model2].map(&:valid?)).all?

This will validate both models, and only return true if they are both valid, meaning that the user will see the errors for both models before resubmitting the corrected form.