Barbie used .any? to check if her array was empty.  "Be careful", said Gloria.  "If that array was an ActiveRecord::Relation, the SQL generated would sub-optimally use COUNT(*) and run a full table scan instead of only trying to access a single row with a LIMIT 1 query."

flag as inappropriate

Create your own!
      Barbie used .any? to check if her array was empty.  "Be careful", said Gloria.  "If that array was an ActiveRecord::Relation, the SQL generated would sub-optimally use COUNT(*) and run a full table scan instead of only trying to access a single row with a LIMIT 1 query."