Create Active Record Self-Referential Relationships In Ruby on Rails

Will Johnson
InstructorWill Johnson
Share this video with your friends

Social Share Links

Send Tweet

If you want to give the users the ability to follow or become friends with each other. Rails lets you create a join table in your database and have it reference the user database table.

You can use Active Record to associate the new table with User table by using the class_name method