This project is archived and is in readonly mode.
Limit failing on Arel Rails 3.0Beta
-
José Valim
- Assigned user set to Pratik
- Milestone cleared.
Could you please try to reproduce this with a failing test case?
-
Denis Odorcic
I'm pretty sure this is not a bug but just a bit confusing when using 'count'.
@comments = Comment.where("user_id = ?", current_user).limit(10) @comments.count returns 250 records because I'm guessing your sql looks something like this
SELECT COUNT(comments.*) FROM comments WHERE (user_id =1) LIMIT 10 and if you try that sql statement out raw you'll see it returns 250.
I think the ruby community is used to doing a .count on an array and getting back the size but its different here.
Now if you did @comments.all.count (or size), you'd get your expected result. -
José Valim
- State changed from new to invalid
OdorcicD, thanks for stepping in. You are right! Marking as invalid.
-
Ryan Bigg
Automatic cleanup of spam.
-
Ryan Bigg
Automatic cleanup of spam.
-
Jeff Kreeftmeijer
Automatic cleanup of spam.