Relationships are Complicated: Rails Active Record Associations
Active Record Associations are what connects models with each other. It seems easy at first, but when you go deeper, it can be confusing.
When I was planning my Rails project, it took me a long time to decide on what to do because I keep on thinking about the relationships of each model. When I did make a decision, it was another dilemma for me when it comes to how each model should be connected with each other. I didn’t want to make it too complex so I just created three models.
As a reference, here are the six types of associations that Rails supports:
★ belongs_to
★ has_one
★ has_many
★ has_many through
★ has_one through
★ has_and_belongs_to_many
For my project, I just used the three most common associations (based on what I encountered): belongs_to, has_many, and has_many through.