vendredi 30 décembre 2016

order with recent created record in multiple associated models rails

i have three associated models

artical.rb:

 has_many :texts
 has_many :notes
 has_many :attachments

i want to order artical with recent created record

artical 6 = text: 20 dec , note: 19 dec, attachment: 20dec
artical 9 = text: 18 dec , note: 21 dec, attachment: not present 
artical 10 = text: not present , note: 30 dec, attachment: not present

Order will Be:

 ###artical Index Page 

 artical 10
 artical 9 
 artical 6

Thanks In Advance

Aucun commentaire:

Enregistrer un commentaire