rails/rails — pull request #10022 by wangjohn (2013-04-01 01:31:24+00:00)
Title: Throwing a RecordNotFound exception when a record is scanned using the inverse_of option

This issue https://github.com/rails/rails/issues/10019 cropped up after I made the following change: https://github.com/rails/rails/commit/840ca09. The change makes it so that if the ``:inverse_of`` option is specified on an association, then ActiveRecord will first check the in-memory association cache for the record before going to the database when ``find()`` is called. However, this not longer throws a ``RecordNotFound`` exception.

In this PR, I'm changing the behavior so that ``RecordNotFound`` is thrown in the correct circumstances. I've also refactored the code in the ``FindersMethod`` module so that it can be reused in the new check I've made.