module RandomOrder::Extension

Public Instance Methods

fast_random(n = 1) click to toggle source
# 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() click to toggle source
# File lib/random_order/random_order/extension.rb, line 3
def random
  self.order(RandomOrder.order_func)
end