Apologies if the title isn't accurate, I had a difficult time distilling this question into a single line. I'm using the amoeba gem and trying to figure out if it's possible to associate a duplicated model with multiple belongs_to relationships.
For instance:
class Building < ActiveRecord::Base
has_many :floors
has_many :layout_groups
end
class Floor < ActiveRecord::Base
belongs_to :building
has_many :units
end
class Unit < ActiveRecord::Base
belongs_to :floor
has_many :layouts
end
class Layout < ActiveRecord::Base
belongs_to :unit
belongs_to :layout_group
end
class LayoutGroup < ActiveRecord::Base
belongs_to :building
has_many :layouts
end
As you can see, Layouts belongs to both Unit and LayoutGroup. If I'm making a complete duplicate of Building, how do I associate layouts with both units and layout_groups but also ensure that two sets of layouts are not created in the process?
Im open to using a non-amoeba solution, I just stated there as it was suggested.