Okay, I have searched for an answer but I keep getting stuck on this problem. I am trying to get the max version for a group of items. This is what I have working, and it grabs all the correct items but does not grab the latest version of them.
def index
@project = Project.find(params[:project_id])
@items = Item.group(:original_id).where(original_id: ItemOriginal.select("id").where(:project_id => @project.id))
end
A project has many ItemOriginals and ItemOriginals have many Items.
I anything I try with max version or last created_at only grabs one record and not a record for each ItemOriginal