Click here to load reader
Upload
rebecca-nelson
View
94
Download
0
Embed Size (px)
Citation preview
SESSIONS AND FLASHWhat goes in a hash?
REVIEW: WHAT IS A SESSION?
A session is a hash that will store information on the client’s server until the session times out or is deleted.
Ex: creating a new session at login to remember a user until they log out or exit the application.
FUN FACTS
➤ Sessions are “lazily loaded”, meaning they will only load if you use them. If you choose not to use sessions, you don’t have to disable them.
➤ You can use the reset_session method to reset the entire session hash.
➤ To store data that persists from session to session, you can store a session in the CookieStore.
WHAT IS THE FLASH HASH?
Much like a session, a flash is a bit of information that is stored on the client’s server. A flash will only last from one request to the next.
MORE ABOUT FLASH
➤ You can create different types of messages, such as :notice or :alert.
➤ You can also create custom alerts such as:
➤ To display multiple flash messages, iterate through the hash using each.
OTHER WAYS TO USE FLASH
flash.now
flash.keep
FUN FACT
➤ Bootstrap has alert classes that can be used to display flash messages.