Reputation: 2381
I'm completely new to rails. While learning I came across the use of the flash variable for maintaining data for the next postback when redirecting.
My questions are
when should this be used.
how does rails maintain it for me, does it make a round trip to the user and back or is it maintained server side.
Any replies would be appreciated
Upvotes: 3
Views: 3608
Reputation: 9815
Your account settings have been updated!
Your password or email is incorrect
etc<%= flash[:whatever] %>
)Upvotes: 6
Reputation: 7288
flash is used to store the data (generally text) which required in next request and it get deleted automatically after the next request.
flash is nothing but an object which stores in session and maintain by rails itself (server side).
Rails initialize the flash object and marked it for removal in next request so it gets deleted in next request.
Upvotes: 3