<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu" -->

---
title: Render flash messages in Hanami, but like a PRO | daily.dev
description: Learn how to render and set flash messages in Hanami using the &#x27;flash_msg&#x27; partial and a custom view helper. Extracting the logic with custom helpers and using...
canonical: https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Render flash messages in Hanami, but like a PRO | daily.dev
og:description: Learn how to render and set flash messages in Hanami using the &#x27;flash_msg&#x27; partial and a custom view helper. Extracting the logic with custom helpers and using...
og:url: https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu
og:image: https://api.daily.dev/og/posts/q43QRXhnu.png
og:image:alt: Render flash messages in Hanami, but like a PRO
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Render flash messages in Hanami, but like a PRO

**[RUBYLAND](https://daily.dev/sources/rubyla)** · [@swilgosz](https://daily.dev/swilgosz) · 14 min read · 0 upvotes · 0 comments

## Summary

Learn how to render and set flash messages in Hanami using the 'flash_msg' partial and a custom view helper. Extracting the logic with custom helpers and using scopes can improve code organization and maintainability.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://hanamimastery.com/episodes/52-render-flash-the-correct-way>

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#ruby](https://daily.dev/tags/ruby), [#hanami](https://daily.dev/tags/hanami)

[View this post on daily.dev](https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Render flash messages in Hanami, but like a PRO","url":"https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu"},"datePublished":"2023-12-19T21:25:30.127Z","dateModified":"2023-12-20T18:00:08.144Z","description":"Learn how to render and set flash messages in Hanami using the 'flash_msg' partial and a custom view helper. Extracting the logic with custom helpers and using...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/de16103e7404bec9deaf7d23394a4d4c?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/de16103e7404bec9deaf7d23394a4d4c?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Sebastian Wilgosz","url":"https://daily.dev/swilgosz","image":"https://avatars.githubusercontent.com/u/8088317?v=4","description":"Creator of Hanami Mastery, Ruby dev, and productivity madman. http://bio.link/swilgosz","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":50}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/render-flash-messages-in-hanami-but-like-a-pro-q43qrxhnu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,ruby,hanami","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"Render flash messages in Hanami, but like a PRO"}]}
```

