Marnen Laibow-Koser wrote:
>> What do you think?
> 
> I think you don't quite understand how SQL databases retrieve records.

Think of it this way: select * from users; returns a record "set." As 
in, "unordered set" as apposed to a record "array." An id field is just 
another column that happens to be used to identify rows. The only 
requirement (assuming id is used as a primary key) is that each value is 
unique. The sequence of those values is undefined. Therefore, the order 
of the record set is undefined.

An "order by" clause is applied to the resulting set before the set is 
returned, which essentially turns it into an "ordered set/array." This 
final result is stored in an Array object by ActiveRecord (another 
ordered storage object) so can be depended upon to be kept in order.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to