[Rails] Types of associations (one-to-many / many-to-many)

For organizing the brain

The first time programming beginners started learning Rails, huh? The association that is (should) be the point. There are many individual articles about associations, so I tried to sort out the types as a whole.

Types of associations

アソシエーション表.png It can be classified as shown in the table. (This time, the one-to-one association was omitted.)

Summary

--Many-to-many requires an intermediate table --Self-join requires a foreign key that references the same model

Recommended Posts

[Rails] Types of associations (one-to-many / many-to-many)
[Rails] Implementation of many-to-many category functions
[Rails] Many-to-many creation
[Rails] Introduction of PAY.JP
Rails Tutorial/Significance of Indexing
[Rails] Implement community membership application / approval function using many-to-many associations
Rails implementation of ajax removal
[Swift] Types of types-Basic knowledge-
[Rails] Introduction of devise Basics
[Ruby] Various types of each
Utilization of Rails Boolean type
[Rails 6] Implementation of search function
About types of code coverage
[Rails] Implementation of category function
[Rails] Implementation of like function