I have two Models, Modela and Modelb.
Modela can only own one Modelb, but Modelb can be a part of many Modela's.
What I have right now is
class Modela < ActiveRecord::Base
has_one :modelb
end
class Modelb < ActiveRecord::Base
belongs_to :modela, :foreign_key => "modela_id" #might not make sense?
end
Not too sure about the whole :foreign_key thing I was doing there, but it was where it was when I left off. As I am trying to allow Modelb to be part of many Modela's, I don't want to add a modela_id field to the Modelb table.
What is the best way to do this?