Rails 3 sort after .where condition using NOT NULL
问题 I have a ranking which shows the fastest User: @users = User.find.sort { |a, b| b.finished_at <=> a.created_at } Now I hat to add some code to prevent getting an error because of finished_at beeing nil until the user finished. @users = User.find(:all, :conditions => "finished_at IS NOT NULL").sort { |a, b| b.finished_at <=> a.created_at } But sort doesn't work. Is this way of chaining methods flawed? And is find(:all, :conditions => "finished_at IS NOT NULL") the rails 3 way or outdated?