<% if photos.nil? or photos.empty? %>

There were no photos found!

<% else -%> <% photos.each_with_index do |photo, idx| -%>
<% if (idx + 1) % 3 == 0 or photos.last == photo -%>
<% end -%> <% end -%> <% end -%>