← Graph

Hanami View Part

concept 3 connections

A part in Hanami View is a Ruby class used to decorate values that the view exposes to a template. In Wilgosz's registration example, a RegistrationFormPart wraps a form hash and defines an `errors(name)` method that always returns an array (never nil) so templates don't need `to_a` transformations. Parts can also host methods like `username_input(form_builder)` that hide scope creation and partial rendering entirely, letting the top-level template read as a list of decorator calls.

category
pattern
about
Hanami View Part concept
Practical pattern using parts
about
Hanami View Part concept
Demonstrates parts as decorators for exposed form values
related_to
Hanami View Part concept
Parts are one of Hanami View's building blocks

Provenance

Read by
1 extraction