Planning the blog: one model, four actions

Free preview 2 min to read

The opposite direction, on purpose

Scaffolding: rapid prototyping ended by generating a complete Article feature in one command: migration, model, seven controller actions and six view files. Then it listed what still needed work: no validations, a permit list that trusted every column, and views with no connection to this project's design. This course builds the same kind of feature by hand, one step at a time, naming the earlier course behind each piece as it goes.

What gets built

A small personal blog. One model, Article, with three columns: title, body and published_at. Four actions, not seven: index lists every article, show reads one, new shows a blank form and create saves what's submitted. The previous course already generated edit, update and destroy. This one stays with what a first working blog needs: writing posts and reading them, not yet editing or deleting them.

The steps ahead

  1. The model and migration, written by hand and checked against a disposable table.
  2. The route and controller, each action tied to the lesson it comes from.
  3. index and show, rendered through a shared partial.
  4. new, create, and the form connecting them.
  5. Styling with this project's Tailwind design tokens.
  6. A wrap-up of this course and of the Rails courses behind it.

Why naming sources matters here

Each earlier course built one piece on its own: a migration, a controller action, a form. None of them put all the pieces together into one working feature, with each choice traceable to where it was taught. That assembly, not any single new idea, is this course's job.

Lesson 1 of 7 · free

Keep going with lesson 2

The model and migration, built by hand

Writes the CreateArticles migration and an Article model with a title validation and a published? method.

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

Type to start searching...