Reputation: 95
How does the framework associate flash
messages with users?
How does it know when to apply it, i.e. after redirect?
Imagine a situation when in between adding a flash
and loading the page the user was redirected to there comes some totally unconnected Ajax request. Will the Rails apply flash notices to the Ajax request?
Upvotes: 2
Views: 1259
Reputation: 43
For rails 7
https://guides.rubyonrails.org/action_controller_overview.html#the-flash
The flash is a special part of the session which is cleared with each request.
Moreover, how session itself stored is detemined by session store
(requires the activerecord-session_store gem) A custom store or a store provided by a third party gem
Upvotes: 1
Reputation: 5188
I don't think flash hashes are associated with users. They are stored in the sessions cookie on the user's browser in order to persist for the next request. For the request following that one the flash hash clears itself out.
Upvotes: 3