What are the different types of association relationships that exist? - Ruby on Rails
What are the different types of association relationships that exist?
-The association relationship depends on the number of models made in the rails application.
-To create the connection for the application the command that is required is createconnection that creates the connection between the models.
-The connection when established there is a need to show the association between the different models and this can be done using three types of associations:
- One-to-one: this is the kind of relationship that exists between one item to another item. For example: Dog->Owner.
- One-to-many: this kind of relationship or association exists between one item to many other item. Teacher-> student.
- Many-to-many: this relationship shows many items to many items association and the items are related to each other. Student->Student.