rails/activerecord-deprecated_finders — pull request #14 by neerajdotname (2013-04-27 18:35:32+00:00)
Title: better fix for #9994

fixes https://github.com/rails/rails/issues/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`.