Is there any way to share an array between controller methods and store it until page reloads or calling method of another controller? Some methods should change the array.
ViewData, ViewBag, and TempData are used to pass data between controller, action, and views. To pass data from the controller to view, either ViewData or ViewBag can be used. To pass data from one controller to another controller, TempData can be used.
Passing the data from Controller to View using TempData To pass the strongly typed data from Controller to View using TempData, we have to make a model class then populate its properties with some data and then pass that data to TempData as Value and selecting Key's name is the programmer's choice.
you can use rails cache.
Rails.cache.write("list",[1,2,3])
Rails.cache.read("list")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With