Bu yüzden, db için bir sorgu gerçekleştiriyorum ve eksiksiz bir nesne dizisine sahibim:
@attachments = Job.find(1).attachments
Şimdi ben başka db sorgusu yapmak istemiyorum nesneler dizisi var, ama esas dizi filtre istiyorum Attachmentnesnenin var file_typeben bir listesi var, böylece attachmentsdosya türü olduğu 'logo've daha sonra bir başka liste attachmentsdosya türü'image'
Bunun gibi bir şey:
@logos = @attachments.where("file_type = ?", 'logo')
@images = @attachments.where("file_type = ?", 'image')
Ancak db sorgusu yerine bellekte.
partition- örnek burada .