Hi, I'm using Rails 3.2.1 and following through Mike Hartl's
tutorial.
irb(main):024:0> User.first
User Load (0.6ms) SELECT "users".* FROM "users" LIMIT 1
=> ...
irb(main):025:0> User.last
User Load (1.0ms) SELECT "users".* FROM "users" ORDER BY
"users"."id" DESC LIMIT 1
=> ...
Here's what PostgreSQL docs say concerning ORDER-less SELECTs:
"If the ORDER BY clause is specified, the returned rows are sorted in
the specified order. If ORDER BY is not given, the rows are returned
in whatever order the system finds fastest to produce. (See ORDER BY
Clause below.)"
So, shouldn't ORDER BY .. ASC be specified explicitly, instead of
relying on an implementation detail that might later change?