Controller/View concerns

you could create a helper, otherwise something like

for idx in 0..1   if @website[idx]      etc

Not sure what the other question you are asking is. You can sort: list.sort {|x,y| x.fld <=> y.fld}

You can use .find on the collection.

website.website_photos.find :all, :limit => 2