|
|
|
|
|
by strken
2094 days ago
|
|
The thing that most annoyed me about Rails (not Ruby) was that users.size
users.length
users.count
are all valid, all useful, all have different meanings, are all present in plain Ruby but with different meanings, and contain absolutely no information about what they do.For reference, .length loads everything and gets the length of the collection, .count runs a SQL COUNT query, and .size uses length if the query has already been run and .count if it hasn't. |
|