Relationship N:N on Ruby on Rails

Asked

Viewed 24 times

0

I have 3 tables in my project that need to be related: responsabilities, knowledges and knowledges_responsabilities, which summarizes :

Each responsabilitie may have 1 or more Knowledges, and each Knowledge belongs to 1 or more responsabilitie.

The knowledges_responsabilities table will contain the id of the two other tables.

The relationship in the model I already made, and fetch the records of Knowledges in the form of Responsabilities I have already managed.

What should I put in the Responsabilities controller to work?

  • 1

    How does it work? How does it work? Get the responsibility data and knowledges?

  • @Cesarmiguel , logically should when selecting which knowledges , a responsabilitie has, he create in the intermediate table the relationship between them. I’m not understanding how to save the id’s in the intermediate table.

  • That’s right. Lack of my research on Stack! Thanks @Andrey.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.