Top "Has-and-belongs-to-many" questions

A has_many :through association set up a many-to-many connection with another model.

Rails migration for has_and_belongs_to_many join table

How do I do a script/generate migration to create a join table for a has_and_belongs_to_many …

ruby-on-rails migration code-generation has-and-belongs-to-many
Rails has_and_belongs_to_many migration

I have two models restaurant and user that I want to perform a has_and_belongs_to_many relationship. I …

ruby-on-rails ruby-on-rails-3 migration has-and-belongs-to-many
How to create has_and_belongs_to_many associations in Factory girl

Given the following class User < ActiveRecord::Base has_and_belongs_to_many :companies end class Company < ActiveRecord::Base …

ruby-on-rails associations has-and-belongs-to-many factory-bot
How do I query data in CakePHP using HABTM relationships?

I'm working on a CakePHP 1.2 application. I have a model "User" defined with a few HABTM relationships with other tables …

php cakephp has-and-belongs-to-many cakephp-1.2
Rails HABTM - Properly removing an association

I am developing a feature for creating specials, for a shopping website. One product can have more than one special, …

ruby-on-rails ruby-on-rails-3 has-and-belongs-to-many
How do I remove a single HABTM associated item without deleting the item itself?

How do you remove a HABTM associated item without deleting the item itself? For example, say I have 3 Students that …

ruby-on-rails associations has-and-belongs-to-many
Add record to a has_and_belongs_to_many relationship

I have two models, users and promotions. The idea is that a promotion can have many users, and a user …

ruby-on-rails has-and-belongs-to-many relationship
Yii framework Many to Many relationships

What is the method to save and update Many to Many relationship in Yii framework?

php has-and-belongs-to-many yii many-to-many
habtm relationship does not support :dependent option

Is it true that HABTM relationships do not support the :dependent option? class Person < ActiveRecord::Base has_and_belongs_…

ruby-on-rails has-and-belongs-to-many
Create join table with no primary key

I have two tables with a many to many relationship that I am using has_and_belongs_to_many to …

ruby-on-rails join primary-key has-and-belongs-to-many