Answer the question
In order to leave comments, you need to log in
How to display data randomly?
Suppose I display some data data=Data.all
. I will display data sorted by ID. And how to display all the data randomly? And so that every time everything is randomized?
If anything, I use kaminari, so making a random array for the array will not work.
Answer the question
In order to leave comments, you need to log in
Use the capabilities of your DBMS.
MySQL
PostgreSQLData.order('RANDOM()').all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question