title: Where do I save a variable that should not be overwritten when I refresh the page in rails
body: <p>I am pretty new to Rails and Ruby and still wrapping my head around the hole concept of Rails.</p>
  
  <p>What I want to do:
  I'm creating a shift-planner with a view of one week and want to create a button that will show the next/last week.</p>
  
  <p>What I did:</p>
  
  <p>I have 3 tables that are relevant. shift, person and test (contains types of shifts)
  Where both Test and Person have one to many relations to Shift.</p>
  
  <p>In my controller I did the following:</p>
  
  <pre><code>def index
    @todos = Todo.all
    @shifts = Shift.all
    @people = Person.all
  
    @start_of_week = Date.new(2015,8,7)
    @end_of_week = Date.new(2015,8,11)
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;% person.shifts.where(:date_of_shift =&gt;  @start_of_week..@end_of_week).order(:date_of_shift).each do |shift| %&gt;
      &lt;td&gt;
          &lt;%="#{shift.test.name} #{shift.date_of_shift}"%&gt;
      &lt;/td&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>My Idea was I would make a link where I would increment both Dates and refresh my Page </p>
  
  <pre><code>&lt;a href="/todos/new"&gt;
      Next Week
      &lt;% @start_of_week += 7 %&gt;
      &lt;% @end_of_week += 7 %&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>Unfortuately that doesn't work. Cause everytime I call the index function in my controller it sets the date on the default value.</p>
  
  <p>And I'm pretty clueless how to fix this problem in a rails way.
  My only would be to somehow pass the dates as parameter to the index function or something like that.</p>
  
  <p>The general structure is:
  I scaffolded a Todo view/controller/db just for the sake of having a view / controller and my 3 tables.</p>
  
  <p>Thx for the help.
  PS: I'm using the current version of ruby and rails on lubuntu15 (shouldn't be really releveant^^)</p>