The Magic of Associations with ActiveRecord
29-Mar-2019 1812
The world of Object Oriented Programming seemed very complex and confusing to me. It was only when I realised that the models we create represented real-life objects and the way they interacted with each other were like relationships between objects, for example, if you looked at a restaurant reviewing app. The objects could be customer, restaurant, and the review. This would be a many through relationship. Many customers could be linked with many restaurants through the reviews.When I was first introduced to object relationships it was using Ruby alone with no other frameworks/libraries. To set up the example of restaurant reviews you’d do something like this.
The Magic of Associations with ActiveRecord #ruby #rubydeveloper #rubyonrails #Magic #Associations #ActiveRecord #activerecord https://rubyonrails.ba/link/the-magic-of-associations-with-activerecord