On Jul 2, 2006, at 8:21 , Coda Hale wrote:
If there is no existing :order option in the find itself, the ORDER BY clause begins with the primary key of the model being searched, which is the default SQL order.
I can't speak to the correctness of the rest of the patch (though it seems pretty nifty to me :), this assumption is false. There is no guaranteed order in SQL without an explicit ORDER BY clause. Any ordering you may see in cases without an ORDER BY clause is an implementation artifact and can easily vary with the dbms and even the query itself.
I'm not familiar enough with the ActiveRecord code to know whether or not ActiveRecord adds a default ORDER BY #{table_name}.# {primary_key}, in which case what is specified by the SQL standard is pretty much moot so feel free to ignore all of this :). I'd be surprised if ActiveRecord *does* add a default ORDER BY as this could affect performance.
From what I see, this is just a small part of the patch though, and it can easily be amended by removing c136-140.
Michael Glaesemann grzm seespotcode net _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core