Project: Advanced Associations

Introduction

This final chapter of the RoR Tutorial will require you to have users following users.

Project: Ruby on Rails Tutorial

You’re on the last chapter! This one will require you to implement the final piece of functionality that makes microblogging what it is – allowing users to follow each other. With your now excellent knowledge of associations, you should be able to see that you’ll run into some naming issues (you won’t get too far with a User who has_many :users). It’s a many-to-many relationship that uses the SAME model for both sides (“self-referential”)!

As an added bonus, you’ll get a chance to touch a bit of AJAX when making it so the buttons for following don’t actually refresh the page with each push. Hooray learning!

Assignment

  1. You’ve got a User model. Write down how you would implement (and name) the associations necessary to make one user follow another. You’ll get a lot more out of the tutorial chapter if you think it through first.
  2. Do the Ruby on Rails Tutorial Chapter 14, “Following users”.

Additional Resources

This section contains helpful links to other content. It isn’t required, so consider it supplemental for if you need to dive deeper into something.

Ruby on Rails

Project: Advanced Associations

Got questions?

Chat with our friendly Odin community in our Gitter chatrooms!

Open Gitter

Are you interested in accelerating your web development learning experience?

Get started

Thinkful

  • 5-6 months

    5-6 months

  • Job Guarantee

    Job Guarantee

  • 1-on-1 Mentorship

    1-on-1 Mentorship