Rails ORM, can it cope with a compound Primary key of two foreign keys referencing the same table?

I suspect that with structures such as 'elements. Id = inter_element_links. Element1_id OR elements.Id = inter_element_links.

Element2_id' you may be implementing polymorphic relationships so I would look more into those associations.

Thanks Michael, I will have a look and let you know... – AJP Aug 30 at 17:20.

I have used this plugin to successfully get a Rails imitation Primary key on InterElementLink so if there's one where element1_id = 3 and element2_id = 5, a call to InterElementLink. Find(3,5) works, but obviously InterElementLink. Find(5,3) doesn't work... and I/ActiveRecord will need it to.

I understand ORMs including ActiveRecord don't support foreign keys, see a good discussion about this (though I understand you can use this plug in). I tried this to make a primary key, but that failed. Thanks very much!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions