fix polymorphic relationship w/ inherited classes

When defining a polymorphic relationship with an object of a type that inherits
from an ActiveRecord class, rather than an instance of the AR class itself, the
id columns should be named according to the associated object, not the parent
ActiveRecord class.