items.last is most recent?

If a model :has_many :items, can I rely on items.last being the most recently created Item?
Or is this just a really bad idea?

Thanks,
-george

The ideal way to do this is the have the timestamp data in the
database. Then do an model.items.find(:first, :order => "created_at
DESC").

If a model :has_many :items, can I rely on items.last being the most
recently created Item?
Or is this just a really bad idea?

Bad idea unless you add an :order => 'created_at' to that :has_many.

Thanks. I didn't know that could be done.

And in Rails 2.1, it’s easier

class Article < ActiveRecord::Base
named_scope :latest, :limit => 1, :order => “created_at DESC”
end

@latest = Article.latest