Loading…
0+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes .
Rails associations are tested in almost every intermediate interview. This module covers belongs_to (required: true by default since Rails 5), has_one, has_many, has_many :through vs has_and_belongs_to_many (always prefer :through for extensibility), polymorphic associations with as: and source_type:, self-referential associations, the dependent: :destroy vs :nullify vs :restrict_with_error options and when each is correct, inverse_of and why it prevents duplicate object creation and validation errors, counter_cache, touch for cache invalidation, association callbacks (before_add/after_add/before_remove/after_remove), strict_loading for N+1 detection in development, and foreign_key/primary_key overrides. Every answer names the SQL generated.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–0 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–0 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q0.