A good question to ask an AI tutor

Free preview 2 min to read

The same two lines, two different requests

link_to "Home", root_path and Article.find(1) both work the moment you type them, with no visible explanation of why. One student asks an AI assistant: "write me a method that finds an article by id." Another asks: "I have this Article.find(1) line, and it finds a row in a table called articles that nobody ever told it about. Why does that work?" The first question skips understanding. The second uses the AI as what this course means by a tutor, not a code generator.

Rails' "magic," named honestly

The Rails way already used that word for this feeling. link_to "knowing" a route, or a model reaching a table nobody named, looks like magic the first time you see it. It isn't. Each of these conventions is ordinary code that runs at a specific, findable moment, doing something a beginner can trace and understand.

Two ways to use an AI assistant here

Ask "why does this work" with the code in hand, then follow the answer down to something you can check. That's a good use of an AI assistant, and it's this course's subject. Asking an AI for a working method and pasting it in unread is a different activity. This course doesn't teach it.

What this course covers

  1. Why link_to knows root_path is a real destination, traced to Rails' source.
  2. Why Article maps to a table called articles, traced the same way.
  3. The line between asking why and copying blindly.
  4. How to phrase a why-question that gets a mechanism instead of reassurance.
  5. Checking an AI tutor's explanation against code or docs, with the same skepticism the previous course applied to a diagnosis.
  6. Where this leaves the intern level, and what comes next.

By the end, "it's just Rails magic" stops being an answer you'll accept from yourself.

Lesson 1 of 7 · free

Keep going with lesson 2

Why link_to knows the route

Traces root_path to NamedRouteCollection, which calls define_method for each named route when the routes are drawn.

A free account also gives you the quizzes, your progress and notes, and the discussion.

Type to start searching...