module Randumb::ActiveRecord::Base

Class methods where(nil) is because: stackoverflow.com/questions/18198963/with-rails-4-model-scoped-is-deprecated-but-model-all-cant-replace-it

Public Instance Methods

order_by_rand(opts = {}) click to toggle source
# File lib/randumb/relation.rb, line 175
def order_by_rand(opts = {})
  where(nil).order_by_rand(opts)
end
order_by_rand_weighted(ranking_column, opts={}) click to toggle source
# File lib/randumb/relation.rb, line 179
def order_by_rand_weighted(ranking_column, opts={})
  where(nil).order_by_rand_weighted(ranking_column, opts)
end
random(max_items = nil, opts = {}) click to toggle source
# File lib/randumb/relation.rb, line 163
def random(max_items = nil, opts = {})
  where(nil).random(max_items, opts)
end
random_by_id_shuffle(max_items = nil, opts = {}) click to toggle source
# File lib/randumb/relation.rb, line 171
def random_by_id_shuffle(max_items = nil, opts = {})
  where(nil).random_by_id_shuffle(max_items, opts)
end
random_weighted(ranking_column, max_items = nil, opts = {}) click to toggle source
# File lib/randumb/relation.rb, line 167
def random_weighted(ranking_column, max_items = nil, opts = {})
  where(nil).random_weighted(ranking_column, max_items, opts)
end