Finding via recently created nested resource

I have Articles and Comments. Comments are RESTfully nested in Articles
(articles/1/comments/2 etc).

I am attempting to display articles via how recently created their last
comment was -- basically how any forum is ordered. How would I do this?
Thank you very much.

One possible approach is to:

  1. add a commented_at timestamp column to Article.

  2. in your Comment model, put in code for after_create to set the parent

Article’s commented_at column to the current date time.

  1. now, when you do Article.find, just add an option for :order => ‘commented_at DESC’

Hope this helps.

Franz