MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.

I'm not curious

Active Record Associations in Rails

Course Summary

Most of your Rails models are going to be connected to other models in some way. An Author has many Articles, and each Article belongs to an Author. A Doctor has many Patients, and a Patient may have many Doctors as well. Rails uses associations to make it easy to track these relationships in your database.

  • +

    Course Syllabus

    Active Record Associations

    Our blog app doesn't allow users to tell us how awesome our posts are. This situation is, of course, unacceptable. So we're going to need a comments system. We need to be able to associate comments with a particular post. 11 steps
    • Introduction 2:52
    • Has Many Associations 8:53
    • Has Many 1 objective
    • Association Methods 1 objective
    • A "Has Many" Migration 1 objective
    • Belongs To Associations 2:20
    • "Belongs To" Associations 1 objective
    • Variations on Foreign Key Migrations 6:31
    • Has and Belongs to Many Associations 6:32
    • Has Many Through Associations 7:26
    • Has One Associations 3:39

    Using Associations in Your App

    Working with associated models in your controllers won't be much different from working with them in the Rails console. But rendering them in your views and representing the association in your routes might take a little more work. We'll cover those details and more in this stage. 8 steps

    More Association Options

    When it comes down to it, associations really just make some changes to the SQL queries that Active Record runs on your database. If you want, Rails gives you the power to take more control over those queries. In this stage, we'll look at some options for doing that. 6 steps

Course Fee:
USD 25

Course Type:


Course Status:



1 - 4 hours / week

This course is listed under Open Source , Development & Implementations and Data & Information Management Community

Related Posts:

Attended this course?

Back to Top

Awards & Accolades for MyTechLogy
Winner of
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url