From the course: Ruby on Rails 5 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Flash hash

Flash hash - Ruby on Rails Tutorial

From the course: Ruby on Rails 5 Essential Training

Start my 1-month free trial

Flash hash

- [Instructor] The CRUD code that we've written is not particularly user-friendly whenever we successfully process a form and redirect the user to another action. A better user interface would be to display a status message that says something like subject added successfully, or subject updated successfully right after the redirect once the user lands on the new page. But as we saw earlier when we were examining the request response cycle, a redirect is actually a new request from the browser. It's not dissimilar from typing in a url directly. Any variables which were set in the first request response cycle, before the redirect, won't be available in the second request response cycle after the redirect. This is a classic problem with HTMl because HTML is a stateless environment. It doesn't keep track of information from previous pages. It submits a fresh request for each page. But we can keep track of data between requests by using cookies and sessions. The basic idea is that when…

Contents