1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added docs for habtm association about the declaring model referring to zero or more associations

parent f4471fc728
author Sandip Mane <sandip.mane@bigbinary.com> 1593247595 +0530
committer Sandip Mane <sandip2490@gmail.com> 1597253412 +0530

Adds doc for habtm association for always optional: true

Added docs line under definition of habtm with a text containing habtm refers to zero or more associations

Added docs line under definition of habtm with a text containing it refers to zero or more associations

Updated the sentence to include declaring association for habtm relation
This commit is contained in:
Sandip Mane 2020-06-27 14:16:35 +05:30 committed by Sandip Mane
parent f4471fc728
commit 810f2a65c3

View file

@ -356,7 +356,9 @@ end
### The `has_and_belongs_to_many` Association ### The `has_and_belongs_to_many` Association
A `has_and_belongs_to_many` association creates a direct many-to-many connection with another model, with no intervening model. For example, if your application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies, you could declare the models this way: A `has_and_belongs_to_many` association creates a direct many-to-many connection with another model, with no intervening model.
This association indicates that each instance of the declaring model refers to zero or more instances of another model.
For example, if your application includes assemblies and parts, with each assembly having many parts and each part appearing in many assemblies, you could declare the models this way:
```ruby ```ruby
class Assembly < ApplicationRecord class Assembly < ApplicationRecord