From 8891307ad13ec2bf4ab0fc987bb11297fd349a98 Mon Sep 17 00:00:00 2001 From: Jon Allured Date: Sat, 24 Feb 2024 16:51:11 -0600 Subject: [PATCH] Add method to return a random record --- app/models/application_record.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba..5a68703 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,7 @@ class ApplicationRecord < ActiveRecord::Base self.abstract_class = true + + def self.random + order("RANDOM()").limit(1).first + end end