Back to Practice

Practice · Interview · Card 6

"Walk me through what happens when belongs_to runs."

A deep-dive question. The interviewer wants to hear that you know the framework, not just that you use it.

The question

An interviewer asks:

"When I write belongs_to :user in a model, what does Rails actually do at class-load time? Be specific."

Your job

Form an answer in your head. Don't reach for the docs. When you have it, reveal the rubric and compare. The rubric isn't "the right script" — it's what an interviewer will be listening for.

Take a moment. Think about: how many methods does belongs_to add, what class-level metadata it registers, what validation it installs by default, and where the implementation lives.