Skip to content

Commit

Permalink
Add method to return a random record
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Feb 24, 2024
1 parent 87e1d1f commit 8891307
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true

def self.random
order("RANDOM()").limit(1).first
end
end

0 comments on commit 8891307

Please sign in to comment.