title: Simple Sinatra Pagination
body: <p>I am working with an API and I am trying to develop a simple pagination from scratch in Sinatra</p>
  
  <p>This is my Sinatra route - it performs the API Call and returns 25 matters with the limit: 25 parameter and stores the resulting array in @matter -  </p>
  
  <pre><code> get '/matters' do
    @matter = client.matters.list(limit: 25)
    slim :matters
   end
  </code></pre>
  
  <p>My plan to get additional matters is </p>
  
  <pre><code>get '/next_matters' do
    @matter = client.matters.next_page
    slim :matters
  end
  </code></pre>
  
  <p>Which supposedly returns the next 25 matters
  This is my slim code at the bottom of the list of matters:</p>
  
  <pre><code>a href= "/next_matters" Next
  </code></pre>
  
  <p>This does not work - It returns nothing - I am sure this is because when I call next_matters is does not remember the state from client.matters.list(limit: 25).</p>
  
  <p>Do I need a helper method for this?</p>
  
  <p>When I try:</p>
  
  <pre><code>  get '/matters' do
     @matter = client.matters.list(limit: 25)
     @matter2 = client.matters.next_page
    slim :matters
   end
  </code></pre>
  
  <p>I can list 50 matters - some how I need to pass the fact that I have called list previously</p>
  
  <p>How do I do this?</p>