Ruby on rails - flash variable

I am brand new to rails. During training, I came across using a flash variable to save data for the next postback when redirecting.

My questions

  • when to use it.

  • how rails support it for me, whether it makes a return trip to the user and back, or supports the server side.

  • if the server side is supported, how the rails know when to discard a variable and not clog its memory.

Any answers would be appreciated.

+3
source share
2 answers

flash is used to store data (usually text) that is required in the next request, and they are automatically deleted after the next request.

flash - , , ( ).

Rails Flash- , .

+3
  • , Your account settings have been updated! Your password or email is incorrect ..
  • Rails , , ( <%= flash[:whatever] %>)
  • Rails ,
+6

Source: https://habr.com/ru/post/1775178/


All Articles