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.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle