SMRTR ProgrammingOct 5, 2025Daily.dev

Hanami for Rails Developers: Part 2: Controllers

SMRTR summary

This tutorial demonstrates how Hanami handles web requests differently than Rails by splitting controller logic between separate "actions" and "views" classes. Hanami actions handle request parameters and decide which view to render, while views gather and present data through templates. The tutorial shows how to create routes for displaying books, including a parameterized route that filters books by year, with database queries placed in view classes rather than actions. This separation allows actions to make routing decisions before any database work occurs, creating a clearer division of responsibilities.

SMRTR provides this summary for quick context. The original article belongs to Daily.dev.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.