Extract ActiveRecord version dependent association_class method