Sorting By Last Comment? ("post.comments.first.created_on")

Why are you doing comments.first? You’ll only ever get the most recent comment if there’s only one there.

post.comments.find(:first, :order => “created_on DESC”).created_on

should get you what you need.

Also, just so you know, the Ruby Way of your code is as follows:

Post.find(:all).each do |post| … end

Jason