True, you should not do redirect_to '/'
. You must define the root in the routes file and then make redirect_to root_path
.
Edit:. Unfortunately, this was a comment on SpyrosP's answer.
Also: Here are some suggestions for excellence on flash. In particular, it can ease your mind:
A flash is a special part of a session that is cleared with every request. This means that the values ​​stored there will be available only in the next request, which is useful for storing error messages, etc.
The interesting thing is that yes, this is part of the session, so the answers to “use session instead of flash” are erroneous, as Justin Ethedge already said. Another thing is that he says that it is useful for storing messages, and not just for storing messages. With the added "etc." This would make me believe that user information is also stored as part of the intended use.
In the end, I agree with Aditya Sanghi that you should just save the user settings, and not the entire user object in flash.
James source share