Table with two foreign keys to the same lookup table
I am new to Ruby, I am trying to use Rails to build a web interface for a legacy engineering database. Problem what I am facing now is that in many cases one table has 2 references to the same lookup table, for example table ValveCatalog has 2 fields: NPSMinKey and NPSMaxKey - references to the same table NPS with primary key NPS_ID. Or another example - each valve has 2 fields for material - body material and bolt material.
The question is - how should I describe this situations in the model, I don't think I can use belongs_to ... any ideas?