Module: RandomOrder::Extension
- Included in:
- Railtie
- Defined in:
- lib/random_order/random_order/extension.rb
Instance Method Summary collapse
Instance Method Details
#fast_random(n = 1) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/random_order/random_order/extension.rb', line 7 def fast_random(n = 1) if self.primary_key.present? RandomOrder.sql_query_string(self, n) else random.limit(n) end end |
#random ⇒ Object
3 4 5 |
# File 'lib/random_order/random_order/extension.rb', line 3 def random self.order(RandomOrder.order_func) end |