code for integrate $_has_many for many columns foreign keys