real array via has_many

The way to implement arrays in ActiveRecord is via has_many.
But, normally Ruby arrays keep the order of elements, while has_many do
not.
This is not just a matter of "order by" clause.
At every update one needs to index database table rows properly, so that
"order by" would work.

Thanks in advance.

Has many does not resemble an array but a set.

Yes. So how one can handle arrays properly?

You have to add an index column and use order by. SQL as a standard does not guarantee any ordering unless you enforce it, so any implementation can return elements in the order that is most efficient.

Can you give us more information on what is in your array and for what
reason they are sorted? Someone may be able to suggest a better
solution to the problem.

Please quote the relevant parts of previous message when posting, this
is a mailing list not a forum (though you may be accessing it via a
forum-like interface) so it is not always obvious which message you
are replying to. Thanks.

Colin

I think I found a solution: act_as_list.
Sometimes we just need persistant storage.

Thanks.