Sha256: 05328c7ef5a50a27c7bd161eedd4012f82aec1255c96c756c1b67e54463bb376
Contents?: true
Size: 510 Bytes
Versions: 14
Compression:
Stored size: 510 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # A concern with the components needed when you want a model to have a component. module Randomable extend ActiveSupport::Concern class_methods do # Public: Randomly orders a collection given a seed. def order_randomly(seed) transaction do connection.execute("SELECT setseed(#{connection.quote(seed)})") order(Arel.sql("RANDOM()")).load end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems