As frankodwyer said, you really want to be using the Rails associations to state the fact that one Model is related to another. If there is a one to one relationship, then you would use
belongs_to
and
has_one
And depending on which model has the foreign key, you use one or the other. In your example, it sounds like DataTypeTwo has the foreign key, back to DataTypeOne. So you would have something like this:
class DataTypeTwo < ActiveRecord::Base
belongs_to :data_type_one
end
class DataTypeOne < ActiveRecord::Base
has_one :data_type_two
end
And you can create records with the foreign keys like this
one = DataTypeOne.create(...)
two = DataTypeTwo.create(...)
two.data_type_one = one
two.save
There are some shortcuts, but this is the verbose gist of it. Assuming all your model names and foreign keys can be obtained by reflection, then you're OK, otherwise you have to explicitly name the keys.
All of this is covered in detail in the ActiveRecord docs:
http://api.rubyonrails.org/classes/ActiveRecord/Base.html