Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

Choosing Between has_many :through and has_and_belongs_to_many

In Rails we can establish many to many relationship between two models in two ways 1) by using has_and_belongs_to_many 2) by using has_many :through associations. We generally use HABTM when we dont require a third intervening model to join t...

has_and_belongs_to_many relation in rails

has_and_belongs_to_many association is used in rails where we dont need a third joining model to establish the relation between the two model. There will be no additional columns (except the foreign keys) of the third joining table. For exampl...
Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: