The code does not properly determine the primary_key_name value from
the association reflection when a 'belongs_to' association is
specified with the :class_name option. Example from the patch I've
submitted:
class Reading < ActiveRecord::Base
belongs_to :article
belongs_to :reader, :class_name => "User"
end
Failing test:
def test_belongs_to_with_class_name
@reading = Reading.find(:first)
assert_not_nil @reading.reader
end
The value of AssociationReflection#primary_key_name in this case will
be "user_id" instead of "reader_id", as it should be.
Patch file:
http://compositekeys.googlegroups.com/web/belongs_to_with_class_name.patch