title: Devise after_sign_in_path_for ... sending to .... root_path - query
body: <p>I need help with a routes issue with devise authentication gem to redirect to a custom page after successful login so as to create a new record by entering a test person name and age ( test data ) </p>
  
  <p>I am using Rails 3 with devise version 1.4.9</p>
  
  <p>My routes are as below</p>
  
  <pre><code>    new_user_session GET    /users/sign_in(.:format)       {:action=&gt;"new", :controller=&gt;"devise/sessions"}
          user_session POST   /users/sign_in(.:format)       {:action=&gt;"create", :controller=&gt;"devise/sessions"}
  destroy_user_session DELETE /users/sign_out(.:format)      {:action=&gt;"destroy", :controller=&gt;"devise/sessions"}
         user_password POST   /users/password(.:format)      {:action=&gt;"create", :controller=&gt;"devise/passwords"}
     new_user_password GET    /users/password/new(.:format)  {:action=&gt;"new", :controller=&gt;"devise/passwords"}
    edit_user_password GET    /users/password/edit(.:format) {:action=&gt;"edit", :controller=&gt;"devise/passwords"}
                       PUT    /users/password(.:format)      {:action=&gt;"update", :controller=&gt;"devise/passwords"}
     cancel_user_registration GET    /users/cancel(.:format)        {:action=&gt;"cancel", :controller=&gt;"devise/registrations"}
     user_registration POST   /users(.:format)               {:action=&gt;"create", :controller=&gt;"devise/registrations"}
     new_user_registration GET    /users/sign_up(.:format)       {:action=&gt;"new", :controller=&gt;"devise/registrations"}
     edit_user_registration GET    /users/edit(.:format)          {:action=&gt;"edit", :controller=&gt;"devise/registrations"}
                       PUT    /users(.:format)               {:action=&gt;"update", :controller=&gt;"devise/registrations"}
                       DELETE /users(.:format)               {:action=&gt;"destroy", :controller=&gt;"devise/registrations"}
               testers GET    /testers(.:format)             {:action=&gt;"index", :controller=&gt;"testers"}
                       POST   /testers(.:format)             {:action=&gt;"create", :controller=&gt;"testers"}
            new_tester GET    /testers/new(.:format)         {:action=&gt;"new", :controller=&gt;"testers"}
           edit_tester GET    /testers/:id/edit(.:format)    {:action=&gt;"edit", :controller=&gt;"testers"}
                tester GET    /testers/:id(.:format)         {:action=&gt;"show", :controller=&gt;"testers"}
                       PUT    /testers/:id(.:format)         {:action=&gt;"update", :controller=&gt;"testers"}
                       DELETE /testers/:id(.:format)         {:action=&gt;"destroy", :controller=&gt;"testers"}
                  root        /                              {:controller=&gt;"testers", :action=&gt;"index"}
  </code></pre>
  
  <p>In applications controller i tried to override the method like below but to no avail i still get routed back to tester index</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
  
    protect_from_forgery
  
    def after_sign_in_path_for(resource) 
  
        new_tester_path
  
    end
  
  end
  </code></pre>
  
  <p>In my routes.rb file i have the below lines</p>
  
  <pre><code>Testing::Application.routes.draw do
  
    devise_for :users 
  
    resources :testers
  
    root :to =&gt; 'testers#index'
  </code></pre>
  
  <p>While much of the code was done with scaffolding I was still not be able to figure how to redirect to <strong>new_tester_path</strong> or route <strong>/testers/new</strong> after <strong>successful sign_in</strong> by user email and password.</p>
  
  <p>Can someone please let me know what i am missing..... while writing the override function, I  would like to know the exact route i need to specify. </p>
  
  <p>While testing i tried something stupid like this but the google page is also not opening ... :( </p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base 
  
  protect_from_forgery 
  
  helper ApplicationHelper
  
  def after_sign_in_path_for(resource) 
  
  "www.google.com" 
  
  end 
  
  def after_sign_up_path_for(resource) 
  
  "www.google.com" 
  
  end 
  
  def after_update_path_for(resource) 
  
  "www.google.com" 
  
  end 
  </code></pre>