aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/batches_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add ActiveRecord::Relation#in_batchesSina Siadat2015-08-071-2/+230
| | | | | | | | | | | | | | | | | `in_batches` yields Relation objects if a block is given, otherwise it returns an instance of `BatchEnumerator`. The existing `find_each` and `find_in_batches` methods work with batches of records. The new API allows working with relation batches as well. Examples: Person.in_batches.each_record(&:party_all_night!) Person.in_batches.update_all(awesome: true) Person.in_batches.delete_all Person.in_batches.map do |relation| relation.delete_all sleep 10 # Throttles the delete queries end
* use correct method in batches testyuuji.yaginuma2015-03-291-2/+3
|
* Deprecated passing of `start` value to `find_in_batches` and `find_each` in ↵Vipul A M2015-02-171-7/+28
| | | | favour of `begin_at` value.
* Add an option `end_at` to `find_in_batches`Vipul A M2015-02-091-0/+9
| | | | that complements the `start`parameter to specify where to stop batch processing
* Return sized enumerator from Batches#find_eachMarc-Andre Lafortune2014-02-051-0/+8
|
* Return sized enumerator from Batches#find_in_batchesMarc-Andre Lafortune2014-02-051-0/+10
|
* find_in_batches should not mutate its argumentMarc-Andre Lafortune2014-01-291-0/+6
|
* Merge pull request #13201 from marcandre/find_in_batch_enumeratorRafael Mendonça França2014-01-291-0/+13
|\ | | | | | | | | | | | | | | `find_in_batches` now returns an `Enumerator` Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/relation/batches.rb
| * `find_in_batches` now returns an `Enumerator` when called without a block, ↵Marc-Andre Lafortune2013-12-061-0/+13
| | | | | | | | | | | | so that it can be chained with other `Enumerable` methods.
* | Fail early with "Primary key not included in the custom select clause" in ↵Alexander Balashov2014-01-211-1/+3
|/ | | | | find_in_batches Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.
* Merge pull request #11161 from dmitry/find_in_batches_works_without_loggerCarlos Antonio da Silva2013-06-281-0/+10
|\ | | | | | | | | ActiveRecord find_in_batches should work without logger When I set logger to nil both methods from Batches module find_in_batches or find_each should work anyway.
| * find_in_batches should work without loggerDmitry Polushkin2013-06-281-0/+10
| |
* | When .find_each is called without a block, return an Enumerator.Ben Woosley2013-06-191-0/+18
|/ | | | This lets us do things like call: .find_each.with_index
* In batches test @total was assigned but not used. Use it in tests instead of ↵Alexander Balashov2013-05-211-7/+5
| | | | Post.count
* Fixed typos in ActiveRecordPrathamesh Sonpatki2013-03-281-1/+1
|
* Fix typoAlexander Balashov2013-03-281-1/+1
|
* fix typos in AR. lots of them.Vipul A M2013-03-191-1/+1
|
* Remove extre count, preheat already happens during setupCarlos Antonio da Silva2012-10-311-1/+0
|
* Fix find_in_batches against string IDs when start option is not specified.Alexis Bernard2012-10-311-0/+9
|
* Fix test_find_in_batches_should_use_any_column_as_primary_keySantiago Pastorino2012-09-221-11/+8
|
* start could be a stringSantiago Pastorino2012-09-211-2/+2
| | | | | Related to 761bc751d31c22e2c2fdae2b4cdd435b68b6d783 and eb876c4d07130f15be2cac7be968cc393f959c62
* Revert "Fix find_in_batches with customized primary_key"Santiago Pastorino2012-09-211-1/+5
| | | | | | | This reverts commit 761bc751d31c22e2c2fdae2b4cdd435b68b6d783. This commit wasn't fixing any issue just using the same table for different models with different primary keys.
* Fix find_in_batches with customized primary_keyToshiyuki Kawanishi2012-09-161-0/+11
|
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-1/+1
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-1/+1
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* remove deprecated #find_in_batches callsJon Leighton2012-04-261-14/+2
|
* Sort here to make sure the order is ok.Arun Agrawal2011-09-051-1/+1
|
* We need to recorder here. Need to drop the order from default scope.Arun Agrawal2011-09-051-0/+20
| | | Fixes #2832
* Merge pull request #1807 from caius/find_in_batches_id_bugSantiago Pastorino2011-07-141-0/+16
|\ | | | | Bugfix by stopping find_in_batches using the records after yielding.
| * Stop find_in_batches using the records after yielding.Caius Durling2011-06-211-0/+16
| | | | | | | | | | | | Currently if the code that calls .find_in_batches modifies the yielded array in place then .find_in_batches can enter an infinite loop searching with ruby object ids in the database instead of the primary key of records in the database. This happens because it naively assumes the yielded array hasn't been modified before calling #id on the last object in the array. And ruby (1.8 at least) alias' #id to #object_id so an integer is still returned no matter what the last object is. By moving finding the #id of the last object before yielding the array it means the calling code can do whatever it wants to the array in terms of modifying it in place, and .find_in_batches doesn't care.
* | Make `ActiveRecord::Batches#find_each` to not return `self`.knapo2011-07-071-0/+7
| | | | | | | | This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
* | please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|/
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Quote find_in_batches ORDER BY clause [#6620 state:resolved]Andrew White2011-03-291-0/+10
|
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * preheat the table cache in arelAaron Patterson2011-01-141-0/+1
| |
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-1/+1
| | | | | | | | through association
* | Fix the tests (I have actually verified that these are also the 'right' ↵Jon Leighton2010-10-031-1/+1
|/ | | | fixes, rather than just making the tests pass again)
* corrected AR find_each and find_in_batches to raise when the user uses ↵Josh Kalderimis2010-05-091-0/+14
| | | | | | select but does not specify the primary key Signed-off-by: José Valim <jose.valim@gmail.com>
* Warn scoped order and limit are ignored. [#4123 state:resolved]Emilio Tagua2010-03-291-3/+13
|
* Add new finder methods to association collection.Pratik Naik2009-12-271-1/+1
|
* Ensure ActiveRecord::Base.find_in_batches fires doesnt fire an extra query ↵Pratik Naik2009-03-111-0/+12
| | | | unless needed
* Rename ActiveRecord::Base.each to ActiveRecord::Base.find_eachPratik Naik2009-03-111-3/+3
|
* Added ActiveRecord::Base.each and ActiveRecord::Base.find_in_batches for ↵David Heinemeier Hansson2009-02-231-0/+49
batch processing [DHH/Jamis Buck]