Following is the association between 2 models:
class FotoGossip < ActiveRecord::Base
has_many :uploads
end
class Upload < ActiveRecord::Base
belongs_to :foto_gossip
end
@latest_uploads = Upload.all(:include => :foto_gossip, :order => "created_at DESC", :limit => 5)
It displays the latest 5 photos from Upload model.
But, I want to display 5 images from Uploads, order_by created_date DESC but only 1 image per FotoGossip.
Its something like grouping the recent FotoGossip with its one photo from Uploads model.