is It possible get a shuffle/random
of a collection from action in controller.
def action
#pseudocode something like the next:
@objects = Object.random
respond_to do |format|
format.html
end
end
I now can get shuffle from my view, with:
<% @objects.shuffle.each do |microfunc| %>
.
.
.
<% end %>
On view is possible with each or for loop
. I don't want use loop to get random Object from one collection.
How can I get random objects inside Mongoid::Criteria from my action controller?