Saturday, 31 August 2013

Rails - Is .first guaranteed to be the first created, or just the first fetched?

Rails - Is .first guaranteed to be the first created, or just the first
fetched?

Let's assume I have many User records - if I call User.first is that
guaranteed to be the first user that existed in the database or should I
sort by created_at to make sure that the ordering is by created_at? Please
note that I am using mongoid and not ActiveRecord.

No comments:

Post a Comment