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

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

HABTM Relationship -- How Can I Find A Record Based On An Attribute Of The Associated Model

I have setup this HABTM relationship in the past and it has worked before....Now it isn't and I'm at …

ruby-on-rails find has-and-belongs-to-many
Laravel belongsToMany where doesn't have one of

I have two tables: categories and videos, I then have a pivot table for these as it's a belongsToMany relationship. …

php mysql laravel eloquent has-and-belongs-to-many
How to have many-to-many relationship in rails

I am new to rails, and am trying to set up a many-to-many relationship in my rails project. I have …

ruby-on-rails migration associations has-and-belongs-to-many
Rails: Has and belongs to many (HABTM) -- create association without creating other records

Spent all day on Google, but can't find an answer. :\ I have a HABTM relationship between Users and Core_Values. …

ruby-on-rails activerecord has-and-belongs-to-many
rails 3 habtm delete only association

class Company has_and_belongs_to_many :users end class User has_and_belongs_to_many :companies end when i …

ruby-on-rails ruby-on-rails-3 has-and-belongs-to-many
How to set up a typical users HABTM roles relationship

I'm quite new to this and I'm using cancan + devise for my user auth. However I'm not really sure what …

ruby-on-rails devise relational-database has-and-belongs-to-many cancan
Trying to use accepts_nested_attributes_for and has_and_belongs_to_many but the join table is not being populated

I am learning RoR and trying to use accepts_nested_attributes_for and has_and_belongs_to_many to submit …

ruby-on-rails ruby has-and-belongs-to-many
CakePHP how to retrieve HABTM data with conditions?

I use CakePHP 2.2.2 I have 3 tables: restaurants, kitchens and kitchens_restaurants - join table for HABTM. In Restaurant model I …

php cakephp has-and-belongs-to-many
Efficient ActiveRecord has_and_belongs_to_many query

I have Page and Paragraph models with a has_and_belongs_to_many relation. Given a paragraph_id, I'd like …

ruby-on-rails activerecord has-and-belongs-to-many
has_and_belongs_to_many in Rails

Is there anything explicitly wrong with using has_and_belongs_to_many associations in rails instead of has_many :through? …

ruby-on-rails has-and-belongs-to-many