I have this loop:
<% for post in posts.order_by([:created_at, :desc]).limit(6) %>
post.name
<% end %>
This works fine, but I want now get the name for each post, with random order and limit 6.
I would like how works with for and each block like:
posts.each do |post|
post.name
end
1 Answer