Ruby on Rails 5.0 for Autodidacts: Learn Ruby 2.3 and Rails 5.0 by Stefan Wintermeyer
Author:Stefan Wintermeyer [Wintermeyer, Stefan]
Language: eng
Format: azw3, mobi
Tags: Framework, MVC, Ruby, Ruby on Rails, Rails
Published: 2016-02-07T05:00:00+00:00
redirect_to :back
If you want to redirect the user of your web application to the page he has just been you can use redirect_to :back. This is very useful in a scenario where your user first has to login to get access to a specific page.
Flash Messages
In my eyes, the term “flash messages” is somewhat misleading. Almost anyone would associate the term “Flash” with more or less colorful web pages that were implemented with the Adobe Shockwave Flash Plug-in. But in Ruby on Rails, flash messages are something completely different. They are messages that are displayed, for example on the new page after a redirect (see section Redirects).
Flash messages are good friends with redirects. The two often work together in a team to give the user feedback on an action he just carried out. A typical example of a flash message is the system feedback when a user has logged in. Often the user is redirected back to the original page and gets the message “You are now logged in.”
As an example, we are once more constructing the ping pong scenario from section "Redirects":
$ rails new pingpong [...] $ cd pingpong $ rails generate controller Game ping pong [...]
Download
Ruby on Rails 5.0 for Autodidacts: Learn Ruby 2.3 and Rails 5.0 by Stefan Wintermeyer.mobi
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9365)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9336)
The Mikado Method by Ola Ellnestam Daniel Brolund(9300)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7845)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7397)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7304)
Grails in Action by Glen Smith Peter Ledbrook(7291)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7111)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5951)
Kotlin in Action by Dmitry Jemerov(4633)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(3848)
Functional Programming in JavaScript by Mantyla Dan(3718)
Learning Java by Patrick Niemeyer & Daniel Leuck(2867)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2830)
Mastering Python for Finance by Weiming James Ma;(2825)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2578)
Mastering Java 9 by Dr. Edward Lavieri(2569)
Architecting Modern Java EE Applications: Designing lightweight, business-oriented enterprise applications in the age of cloud, containers, and Java EE 8 by Daschner Sebastian(2555)
Learning Concurrency in Python by Elliot Forbes(2547)