title: Rails user list from database
body: <p>I'm following mhartl's tutorial at ruby.railstutorial.org and I'm having an issue with the index function of the users_controller.  In the console, I can enter this code:</p>
  
  <pre><code>@users = User.all
  </code></pre>
  
  <p>and it properly accesses the SQL database and displays the list of all users.  However, when I try to load the page I get various errors depending on how I use the list in the index file, but all involving the list being nil.  For example, if my index page contains this:</p>
  
  <pre><code>&lt;% @users.each do |user| %&gt;
      &lt;li&gt;
          &lt;%= link_to user.name, user %&gt;
      &lt;/li&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The server spits out:</p>
  
  <pre><code>undefined method `each' for nil:NilClass
  </code></pre>
  
  <p>Something like <code>render @users</code> gives me the error of <code>'nil' is not an ActiveModel-compatible object that returns a valid partial path.</code></p>
  
  <p>I am really confused why I would get this error if it works in the console.  Let me know if you need some other code from me.</p>
  
  <p>Thanks for your help!</p>