On Apr 17, 7:12 pm, SeanWalberg <[email protected]> wrote:
> Why/how is the Array getting resorted when I assign it to the
> association? How do I stop it?
The key bit is the replace method in
http://github.com/rails/rails/blob/70de8e64e30092b2b1b77869e459b4868f5b9577/activerecord/lib/active_record/associations/association_collection.rb
It's trying to minimise the number of delete or updates to the
database, so it first removes all the records that should no longer be
there, then appends all the records that need to be added to the
collection, which will mess with your order if the collection is non
empty to begin with
If you reload the association the records should come out in the right
order
Fred
> Should I be working with a subset of the shift data this way, or is
> there a better way?
> Am I going about this completely wrong?
>
> Thanks,
>
> Sean
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---