aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/batches_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-6/+6
|
* Avoid passing unnecessary arguments to relationDaniel Colson2018-01-241-1/+5
| | | | | | | | | | | | Most of the time the table and predicate_builder passed to Relation.new are exactly the arel_table and predicate builder of the given klass. This uses klass.arel_table and klass.predicate_builder as the defaults, so we don't have to pass them in most cases. This does change the signaure of both Relation and AssocationRelation. Are we ok with that?
* Remove deprecated configuration `.error_on_ignored_order_or_limit`Rafael Mendonça França2017-10-231-28/+0
|
* `quoted_table_name` doesn't respect table aliasRyuta Kamizono2017-09-141-0/+11
| | | | So using `arel_attribute(primary_key).asc` in `batch_order` instead.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Skip query cache for in_batches and friendsEugene Kenny2017-07-061-0/+61
| | | | | | | | | | | The `find_each`, `find_in_batches` and `in_batches` APIs usually operate on large numbers of records, where it's preferable not to load them all into memory at once. If the query cache is enabled, it will hold onto the query results until the end of the execution context (request/job), which means the memory used is still proportional to the total number of records. These queries are typically not repeated, so the query cache isn't desirable here.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActiveRecord frozen string literal friendly.Pat Allan2017-06-201-2/+2
|/
* Should escape meta characters in regexpRyuta Kamizono2017-05-071-2/+2
|
* Remove checks for Enumerator#size methodEugene Kenny2017-04-251-14/+10
| | | | | | | | The Enumerator#size method was introduced in Ruby 2.0. These tests were added when Rails 4.1 was current, and Ruby 1.9.3 was still supported. Since Rails 5 only Ruby >= 2.2.2 is supported, so the checks are no longer necessary.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-10/+10
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* modernizes hash syntax in activerecordXavier Noria2016-08-061-15/+15
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-24/+24
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* deprecates the error_on_ignored_order_or_limit instance readerXavier Noria2016-07-181-2/+10
| | | | | | | | | Albeit the previous existence of this method is not seen in the patch itself, the declaration mattr_accessor :error_on_ignored_order_or_limit, instance_writer: false was present before. It was removed recently in 210012f.
* adds coverage for the deprecation of error_on_ignored_orderXavier Noria2016-07-181-0/+8
|
* adds support for limits in batch processingXavier Noria2016-07-131-10/+122
|
* Fix typoAbhishek Jain2016-06-091-2/+2
|
* Merge pull request #23417 from sgringwe/masterRafael Mendonça França2016-03-011-0/+36
|\ | | | | | | Add option to error on ignored order or limit
| * Add initial support for allowing an error on order or limit of queries being ↵Scott Ringwelski2016-02-021-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ignored in batches add some documentation and add 4 tests regarding error vs. warning behavior fix a typo when referring to the message go back to default in tests so that ordering is not important. use a constant instead of method. fix assert_nothing_raised call. use self.klass to allow per class configuration remove logger warn assets as that is tested elsewhere. pass error_on_ignore through find_each and find_in_batches also. add blocks to the finds so that the code is actually executed put the setting back to default in an ensure Add a changelog entry
* | Fix semantics of test names for finish option in batches_testAkshay2016-02-171-2/+2
|/ | | | - The change was added in #23099
* Changed options for find_each and variants to have options start/finish ↵Vipul A M2016-01-181-33/+12
| | | | | | instead of start_at/end_at based on comments at https://github.com/rails/rails/pull/12257#issuecomment-74688344
* Fix merge conflicts from #19501Sean Griffin2015-10-291-1/+1
|\ | | | | | | | | | | | | | | I'm making this commit separately because this has failing tests and style nitpicks that I'd like to make as individual commits, to make the changes I'm making explicit. We still want a single merge commit at the end, however.
| * DRY up STI subclass logicCody Cutrer2015-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | the newer method used for discriminating new records did not use the older and more robust method used for instantiating existing records, but did have a better post-check to ensure the sublass was in the hierarchy. so move the descendants check to find_sti_class, and then simply call find_sti_class from subclass_from_attributes now with fixed specs
* | Removed mocha from Active Record Part 1Ronak Jangir2015-08-251-11/+14
| |
* | 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.