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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 5 Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
Read action: Index6m 31s
-
Read action: Show5m 22s
-
Form basics5m 13s
-
Create action: New4m 54s
-
Create action: Create5m 27s
-
Strong parameters6m 33s
-
Update actions: Edit/update7m 53s
-
Delete actions: Delete/destroy7m 11s
-
Flash hash7m 28s
-
Challenge: Pages and sections CRUD1m 43s
-
Solution: Pages and sections CRUD7m 38s
-
-
-
-
-
-
-
-
-