I have an Array, composed by multiple Class objects, sorted by shuffle :
@streams = (Product.all + List.all + Post.all).shuffle
In a feed page (like the timeline page on Facebook), the content of the object is displayed with .each, and on each Class, a specific partial is applied :
@streams.each do |stream|
<% if stream.is_a?(Product) %>
<%= render 'product_partial', object: stream %>
<% elsif stream.is_a?(List) %>
<%= render 'list_partial', object: stream %>
<% end %>
<% end %>
Goal : because there is in the app a lot of Products (e.g : 200), and less Posts (100) and even less Lists (10), I want to give an order to each content, with the Class. With this, the Posts & Lists will not be drowned on Products.
In one sentence : for 20 products, show 2 posts, 1 list.
Any ideas ? Many thanks.