title: Adding to / overwriting Devise's current_user method
body: <p>I've got a User model, that has an associated keyholder and guest. To make my code more DRY, I'd like it so that current_user will refer to:
  a) If a user is signed in, it will be the normal Devise current_user object.
  b) If a keyholder is signed in, it will be that keyholder's user - i.e. current_keyholder.user
  c) If a guest is signed in, it will be the guest's user.</p>
  
  <p>I've tried adding helpers into the application controller, however, these don't work as the e.g. current_user isn't being initialized before my code runs.</p>
  
  <p>Basically what I'm trying to achieve is:</p>
  
  <pre><code>  def current_user
      if user_signed_in?
        @current_user ||= warden.authenticate(:scope =&gt; :user)
      elsif keyholder_signed_in?
        @current_user = current_keyholder.user
      elsif guest_signed_in?
        @current_user = current_guest.user
      end
    end 
  </code></pre>
  
  <p>The above code gives me a "stack level too deep" error, but will hopefully show what I'm trying to get working. If anyone can help, that would be great, thanks!</p>