This project is archived and is in readonly mode.
find_each ignores limit
-
José Valim
If you want to iterate just over three objects, you can simply do klass.limit(3).all.each {}, or am I missing something?
If you want to iterate in batches of 3 though, you need to given :batch_size as option.
-
wtn
- Tag changed from activerecord 3.0 to activerecord 3.0, 3.0.0.beta, activerecord, find_each, limit, scope
In ActiveRecord 2.3, one could iterate over the first 3000 of 10000 records without loading all 3000 at once. In ActiveRecord 3.0, this is not possible.
find_eachworks with all other scope methods, so silently discarding limit scopes is inconsistent behavior. I suggest one of two options:find_eachshould ignore limits but issue a warning;find_eachshould behave as under ActiveRecord 2.3 and use the limit.
-
José Valim
- Assigned user set to Emilio Tagua
- Milestone cleared.
-
Repository
- State changed from new to resolved
(from [53ddbfc460f5a54d5b81e7bfbc1c5828f90488c1]) Warn scoped order and limit are ignored. [#4123 find_each ignores limit state:resolved] http://github.com/rails/rails/commit/53ddbfc460f5a54d5b81e7bfbc1c58...