Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:39:45+00:00 2026-06-02T07:39:45+00:00

Devise 2 is really awesome! However, I have been trying superhard to get it

  • 0

Devise 2 is really awesome! However, I have been trying superhard to get it to redirect to users/:id after sign in.

The default page is root after user successfully sign into the site. However, I want it to go to the users/:id page that is controlled by users_controller.rb. After sign in, I can manually enter localhost:3000/users/1 to go to the user profile page where I can access the user information, so the show controller is working fine.

The key question is how to I get the site to go to localhost:3000/users/1 after user 1 signs in.

I read the devise wikis many times and googled a lot. The simplest way is to override devise by adding in application_controller.rb:

def after_sign_in_path_for(resource)
  dashboard_path
end

I guess my question is how to define the dashboard_path? What do I add in config/routes.rb and in application_controller.rb?

Any help is greatly appreciated! I am using devise 2.0 and rails 3.2.3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:39:46+00:00Added an answer on June 2, 2026 at 7:39 am

    First see this link

    I tell you what I do
    routes.rb

      devise_for :users,:has_many => :comments, :controllers => {:sessions => devise/sessions', :registrations => 'devise/registrations'} do       
    
           match '/users/:id/dashboard', :to => "users#dashboard", :as => :dashboard      
    

    Then declare following helpers in your helper.rb file when you use devise keywords
    UsersHelper

     def resource_name     
         :user    
     end    
    
     def resource     
        @resource ||= User.new     
      end     
    
      def devise_mapping     
        @devise_mapping ||= Devise.mappings[:user]      
      end      
    
     end              
    

    Application_controller.rb

     def after_sign_in_path_for(resource)    
         if current_user.admin?     
          stored_location_for(resource) || admin_path     
        else       
           stored_location_for(resource) || dashboard_path(current_user.id)      
         end       
      end       
    

    I hope this would help you.
    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Devise (1.4.8) for my User model and have been trying to implement
I am using Devise gem and I want to change the redirect path after
I wanted to set layout to my Devise sign-in page, so I added the
It's an interesting problem, really, for all you Devise masters you there. We have
I have a really simple association with the Devise user object where each user
Im trying to render the default devise edit registrations view in a modal. The
I'm using Devise, and I've decided to add the lockable option after I've already
I'm using devise/omniauth to do facebook authentication and works great. However, I would like
I'm trying to devise a method that will be able to classify a given
So I am using Devise for user authentication in my rails app. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.