Many-to-many Relationships in Ruby

Photo from http://ilmfruits.com/

Setting up our classes:

Feel free to skip to “accessing information..” if you already have a good grasp on setting up classes.

Accessing information within the Coven class, from Coven:

Testing a variable we created

Accessing information within the BloodOath (joiner) class, from Coven:

To find information from our joiner class from coven, we will define an instance method. In this case, let’s find all of the blood_oaths (BloodOath instances) that a specific instance of coven has. (Reminder that these two methods are the same).

Accessing information within the Witch class, from Coven:

The deliverables that require the ‘bridge’ or joiner are definitely tricky when you first start out, but you will have clarity in time!!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Devin Davis

Devin Davis

Austin, Texas — Software Engineering Student at Flatiron.