Should using destroy on AR association collection updates the collection in memory?

Hi,

I’m currently cleaning up my ticket pool and came across one of the ticket regarding the destroyed object. One person has purposed that the destroyed object should be removed from the list, but I don’t see anymore feedback on this. What do you guys think?

The ticket is this one: https://rails.lighthouseapp.com/projects/8994/tickets/3288-using-destroy-on-ar-association-collection-updates-the-collection-in-memory

Thank you,

Prem

I'm currently cleaning up my ticket pool and came across one of the ticket regarding the destroyed object. One person has purposed that the destroyed object should be removed from the list, but I don't see anymore feedback on this. What do you guys think?

The patches seem to have gone AWOL, not sure if that was a lighthouse bug or if the original reporter removed them?

Personally I think there are too many cases where we won't be able to fix this for us to get too worried about handling this specific case. AR doesn't try to provide completely transparent mapping of object graphs to relational databases so there are a tonne of cases which won't ever be handled such as destroys happening in other processes or other threads. You can always use pirates(:reload) to force the collection to be refetched.

Having said *that*, the proposed change to make the association's own destroy method remove the item from the collection seems pretty straightforward and assuming it's not too tricky to implement we could do that.