I am not quite clear on the life cycle of instance variables in Ruby on Rails.
I have an instance variable
@work_days(into which I fetch and load the list of all working days in a month. The month is selected by the user from adate_selectin the UI).Now I have a
Generate Reportbutton which generates an excel report by calling ashowmethod in the controllerEvery time the user clicks the
Generate Reportbutton (andshowmethod gets called), the value of@work_daysseems to beniland I have to initialize it every time.
Is there a way to avoid this? Why does the value of instance variable become nil every time the controller's method show is called?