On 2 December 2010 11:18, reu <rnavarro1@gmail.com> wrote:
> Not that I think that this is the best way, actually, thats probably
> the worst, but on the same time, it is the easier:
>
> /ORDER BY column/ =~ Model.your_scope.to_sql
I had not thought of doing something like that. Thanks
Colin
>
> On Dec 2, 7:20 am, Colin Law <clan...@googlemail.com> wrote:
>> On 1 December 2010 21:37, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
>>
>> > Colin Law wrote in post #965538:
>> >> On 1 December 2010 20:15, Marnen Laibow-Koser <li...@ruby-forum.com>
>> >> wrote:
>> >>> in the correct order, then your sorting is correct.
>> >> Probably. I may be wrong but I believe that postgreSQL does not even
>> >> guarantee that an unordered query will produce the same results if the
>> >> same query is run twice.
>>
>> > Right, SQL databases cannot be assumed to guarantee this. That's why I
>> > suggested creating the factories in an arbitrary order, different from
>> > what you want to see.
>>
>> I don't think I made my point clearly. I believe that, in theory,
>> even by creating the objects in an arbitrary order one cannot
>> guarantee that an un-ordered query will not coincidentally end up with
>> an ordered set. I do also believe however that the probability of
>> this is so small as to considered negligible. It is still an
>> interesting academic point if not an issue in practice.
>>
>>
>>
>> >> Conceivably therefore I could test without
>> >> the order clause and check it fails, then, thinking I had added the
>> >> order clause re-run the test and find it pass. I think though as I
>> >> said in an earlier post that I can use common sense and assume the
>> >> probability of this is so small as to be insignificant.
>>
>> > Well, if you create the factories in order, then there's a significant
>> > probability of this happening...
>>
>> Certainly.
>>
>> Colin
--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment