Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/quick_random_records.rb
Class Method Summary collapse
Class Method Details
.random_records(quantity, strategy: 1, multiply: 1.05, loop_limit: 3) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/quick_random_records.rb', line 5 def self.random_records(quantity, strategy: 1, multiply: 1.05, loop_limit: 3) case strategy when 1 self.sample_complement_records(quantity, multiply, loop_limit) when 2 self.order_rand_limit_records(quantity) when 3 self.pluck_sample_records(quantity) else "this gem doesn't support strategy other than 1, 2, 3" end end |