# File lib/dm-core/associations/many_to_one.rb, line 106
        def resource_for(source, other_query = nil)
          query = query_for(source, other_query)

          # If the target key is equal to the model key, we can use the
          # Model#get so the IdentityMap is used
          if target_key == target_model.key
            target = target_model.get(*source_key.get!(source))
            if query.conditions.matches?(target)
              target
            else
              nil
            end
          else
            target_model.first(query)
          end
        end