In a dual boot computer the hardware has_and_belongs_to_many OS’s,
each os has only 1 set of hardware–how ever this is not has_many,
belongs_to as the OS does not belong to the hardware, it serves only
as the conduit.
I see no way to express this in rails–its a reverse has_many,
belongs_to, and is really just a semantics difference—but putting
belongs to where it doesnt belong makes things ugly because you put
labels on things that dont make sense.
any help? did i just no find the awnser or does this really not exist?
I’m not sure to understand exactly what you mean, but i’m afraid there
isn’t other way to express what you described.
It sound logical to say that a given Os instance could be linked to
only one set of hardware. And of course a given set of hardware can
“see” many Os running (sometime in the mean time!!). So it looks like
a has_many-belongs_to association.
But you can imagine a Conduit object that can be used as a join table:
class Harware < ActiveRecord
:has_many :os, througt => :conduits
class Os < ActiveRecord
:has_one :hardware, :througt => :conduit
class Conduit < ActiveRecord
I’m not sure it works exactly like that, but hope it helps
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.