title: How to access logged in user from controller in rails 3
body: <p>I'm trying to create a login system in Rails 3 where I can access the logged in user not only from the views but also from the controller/model level. The reason is that I want to adapt functionality according to a privilege system where logged in users may execute different functions than those that are not logged in.</p>
  
  <p>Up to this point, I tried to implement the login system from <a href="http://ruby.railstutorial.org/chapters/sign-in-sign-out" rel="nofollow">railstutorial.com, chapter 9</a>.</p>
  
  <p>When I use the login system only from the view, it works. However, if I try to use the system via a controller, I get the error <code>undefined method 'cookie_jar' for nil:NilClass</code>.</p>
  
  <p>Thank you for any help or best practices you can provide for creating an authentication system where the logged in user can be identified from a controller.</p>