Please sign in to comment.
better fix for #9994
fixes rails/rails#10304 Fix for #9994 is already applied but it is causing problems. Previous fix took the approach of applying checking if the `CollectionProxy` responds to a method or not. If it does then invoke the method on `CollectionProxy` instance. This was needed so that the association record could be created for hm:t . However this approach is causing problem. If someone defines a method called `find_by_anything` on base class then this method is invoked on `CollectionProxy` first. And that's wrong. In this PR the approach is to send the method to base class and if the association is of type hm:t and if the method is `find_or_create` or `find_or_creat!` then invoke. `save_through_record` on the `proxy_association`.
- Loading branch information...
Showing with 27 additions and 6 deletions.