Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: duplicate active record objects on inverse_of
Fixes a bug that causes duplicate references to the same object to be added to the collection association on an active_record object when inverse_of is used. In cases where has_many_inversing is set to true, the set_inverse_instance function calls target= on collection_association during concat resulting in multiple appends to target. This only occurs for new records. This PR introduces changes that sets the index so the duplicate object replaces the original. Closes issue rails#43222. Co-authored-by: Terence Li <terence.li@shopify.com> Co-authored-by: Dave Rose <dave.rose@shopify.com>
- Loading branch information