Alors comme ça limit ne marche pas pour un array ? Remplacé par sample pour avoir des personnalités random 🆒

This commit is contained in:
Marwann 2016-02-07 10:46:17 +01:00
parent 9b62922a8b
commit 7871f32e36

View file

@ -34,7 +34,7 @@
<td style="width:50%; text-align:right;vertical-align:top;padding-top:20px;"> <td style="width:50%; text-align:right;vertical-align:top;padding-top:20px;">
<% subject.associated_public_figures.order(id: :desc).limit(5).each do |public_figure| %> <% subject.associated_public_figures.sample(5).each do |public_figure| %>
<div style="height:30px; width: 30px; -webkit-border-radius: 50%; border-radius: 50%; background: url('<%= public_figure.picture.url %>') 50% 50% no-repeat; background-size:cover; background-position: center center; float:right; margin-right:15px;"></div> <div style="height:30px; width: 30px; -webkit-border-radius: 50%; border-radius: 50%; background: url('<%= public_figure.picture.url %>') 50% 50% no-repeat; background-size:cover; background-position: center center; float:right; margin-right:15px;"></div>
<% end %> <% end %>