Legacy data associations

I have the task to work with a database that I am not allows to modify.
It is a legacy database.

In my class I have put some sample data to illustrate what I am trying
to do. I working with rails 4 and ruby 2.

Can someone please tell me how am I supposed to code this association.
There are no field_id in any of the tables.

Thank you very much in advance!

class Midatum < ActiveRecord::Base

…,|diagn1 |diagn2 |diagn3

----±------±------±-----

…| “0123”| nil |“0124”

…| “0123”| nil |“0124”

…| “0123”| “1123”| nil

belongs_to :icd9, :foreing_key => :diagn1
belongs_to :icd9, :foreing_key => :diagn2
belongs_to :icd9, :foreing_key => :diagn3
end

class icd9 < ActiveRecord::Base

icd9 |description

------±-----------

#“0123” |“some text”
#“0124” |“some other text”
#“1123” |“description text”
#“1133” |“description text”

has_many :midata, :foreing_key => :icd9, :primary_key => :icd9
end