title: redirect_to doesn't work properly
body: <p>I use <code>devise</code> and tried to do the next thing:</p>
  
  <p>when the user sign in/up, I want to redirect him by his role_id (I let id of 1 for some users and 2 for the others).</p>
  
  <p>if his role_id is 1, redirect him to <code>tasksadmins_path</code>, otherwise to <code>workers_path</code>.</p>
  
  <p>so I tried something like:</p>
  
  <p><code>routes.rb</code>:</p>
  
  <pre><code>devise_for :users, :controllers =&gt; { :sessions =&gt; 'user_sessions'} do
     get '/users/sign_out' =&gt; 'devise/sessions#destroy'
     root to: "workers#index"
  end
  
  resources :tasksadmins
  
  resources :workers
  
  root to: "workers#index"
  </code></pre>
  
  <p>and this is my <code>application_controller.rb</code>:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
      include ApplicationHelper
  
      protect_from_forgery
      before_filter :authenticate_user!
  
      rescue_from CanCan::AccessDenied do |exception|
          if current_user.role_ids == [2]
             redirect_to root_url
          else
             redirect_to tasksadmins_path
          end
      end
  end
  </code></pre>