I have 2 questions.
@websites = Website.find(:all)
<% for website in @websites %>
<%for photo in website.website_photos%>
<%= image_tag photo.public_filename, :size => photo.image_size %>
So, i have websites, and they have many website_photos. This code works
fine but how can i display for example 2 first photos, not loop through
all of them, without putting the logic in the view. I could only achieve
this by putting some variables in the view.
- My second question is about general way how to sort stuff. My first
idea was to sort by id of the photo, or maybe make a special boolean
field in the table and if it’s true the photo will be listed on the main
page, otherwise not.