Module: ActiveRecord::Collections::Batching::ClassMethods
- Defined in:
- lib/active_record/collections/batching.rb
Instance Method Summary collapse
- #batch_by_default! ⇒ Object
- #batch_by_default? ⇒ Boolean
- #batching_threshold(threshold = nil) ⇒ Object
- #default_batch_size(size = nil) ⇒ Object
- #page(*num) ⇒ Object (also: #batch)
- #per(num) ⇒ Object (also: #batch_size)
Instance Method Details
#batch_by_default! ⇒ Object
19 20 21 |
# File 'lib/active_record/collections/batching.rb', line 19 def batch_by_default! @batch_by_default = true end |
#batch_by_default? ⇒ Boolean
23 24 25 |
# File 'lib/active_record/collections/batching.rb', line 23 def batch_by_default? @batch_by_default || false end |
#batching_threshold(threshold = nil) ⇒ Object
14 15 16 17 |
# File 'lib/active_record/collections/batching.rb', line 14 def batching_threshold(threshold=nil) @batching_threshold = threshold unless threshold.nil? @batching_threshold ||= 10_000 end |
#default_batch_size(size = nil) ⇒ Object
9 10 11 12 |
# File 'lib/active_record/collections/batching.rb', line 9 def default_batch_size(size=nil) @default_batch_size = size unless size.nil? @default_batch_size ||= 2_000 end |
#page(*num) ⇒ Object Also known as: batch
27 28 29 |
# File 'lib/active_record/collections/batching.rb', line 27 def page(*num) new.page(*num) end |
#per(num) ⇒ Object Also known as: batch_size
32 33 34 |
# File 'lib/active_record/collections/batching.rb', line 32 def per(num) new.per(num) end |