Unsuccessful attempt to properly eager load screenshots.

Currently the virtual attribute "image_url" in the screenshots model
apparently runs one SQL query each to get the packages data.
This commit is contained in:
Christoph Haas 2013-08-07 00:18:20 +02:00
parent 88dfb33721
commit 76d19f7e78
3 changed files with 14 additions and 8 deletions

View file

@ -5,9 +5,7 @@
<ul>
<% @packages.each do |package| %>
<li>
<%= package.name %> <i>(<%= package.description %>)</i>
- has <%= package.screenshots.count %> screenshots
<% if package.screenshots.count>0 %>
<% if package.screenshots %>
<%= image_tag package.screenshots.first.image_url('small') %>
<% end %>
</li>