Finished changes to make gem autodetect if you are using *_by or *_id fields