So to the question can someone please explain WHY is this happening?
Where is the “confusion” in the examples above?
PS.
I have read the CHANGELOG - it does not explain the motivation.
And please, I don’t thing that “This behavior was changed by design. We choose to not support this in Rails 4.0 and we will not bring it back” and “The decision was already made and like I said we will not change it back since it introduce more confusion than feature” are answers to my question at all.
The problem is that using (for instance) delete_if on a collection removes things from the in-memory version but doesn’t persist the changes. It can’t persist the changes, since the records have been removed from the association’s list of records. This is EXACTLY the “confusion” referenced in the tickets.
One of your examples in 12236 highlights this issue: these two code snippets (in Rails 3 or 4) do not do the same thing:
The justification for this change seems preposterous. Why would anyone think that, in the former example, the database has changed? The method called there is named “select!”.
This sounds like a case of a few people writing fragile code without any understanding of what they were doing or the systems they work on, and complaining about it. I suggested that a simple bit of documentation would solve the problem. It doesn’t seem to make much sense to make this particular interface so inconsistent with the rest of ActiveRecord, which absolutely allows you to modify objects in memory.