Simple Many to Many Association
Greetings Geeks, We'll begin by looking at a simple join, and then move on to a more complex join in the next movie. Many-to-many associations are similar to one-to-many associations because they also have an object which has many objects which belong to it. The difference that as a many-to-many, the objects don't belong to it exclusively. For example, a project has_and_belongs_to_many :collaborators. The project can have many collaborators, but the collaborators can also have many projects. It's not like the project owns a collaborator exclusively. They're allowed to work on other projects, too. You have a Blog Post, which has_and_belongs_to_many :categories. If our Blog Post is both in the technology and training categories, it doesn't mean that no other Blog Post can be in the technology and training categories. Technology will have many Blog Posts. ...