Rails : Flash Hash

Tanuka Das
2 min readNov 25, 2019

--

Flash hash is used to display messages when we create, delete, or update a subject.

Inside this create method, we will check if the subject is saved, then used flash to display that the data has been passed and created successfully. I passed the message as a string. We can also pass an object but object uses lots of memory.

We can use this flash hash to display the message in the update or/and delete method. Then we redirected to either show page or index page, which means we’ve to make changes in those files in order to print the message.

Starting with if condition we use .blank? to check if the string of the flash message is empty or not. If it's not empty, print the flash notice. Similarly, we can use the same method to display the flash hash on the show page.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Tanuka Das
Tanuka Das

Written by Tanuka Das

Software Developer, technical writer, bookworm, constant learner.

No responses yet

Write a response