Rails Get Random Record

[Solved] Rails Get Random Record | Ruby - Code Explorer | yomemimo.com
Question : rails get random record

Answered by : joao-goncalves

User.find(User.pluck(:id).sample)

Source : https://stackoverflow.com/questions/49525843/rails-get-a-random-record-from-db | Last Update : Wed, 25 May 22

Answers related to rails get random record

Code Explorer Popular Question For Ruby