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 7432983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:32:37+00:00 2026-05-29T09:32:37+00:00

I am using devise for my authentication system and on the main page I

  • 0

I am using devise for my authentication system and on the main page I have the login screen and it creates users and logs them in perfectly. But after login it just go right back to the index page whereas I want it to redirect to the actual User’s page ie localhost:3000/user/1. I want this page to only be viewable by the user that is signed in, IE: other users can’t view other user’s profiles. If someone tries to navigate to lets say localhost:3000/user/2…they will be presented with a login screen and the credentials have to match that user.

I know this is a complicated question but any help would be useful.

  • 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-05-29T09:32:38+00:00Added an answer on May 29, 2026 at 9:32 am

    What you’re describing to me sounds like you’re mixing Authentication and Authorization. I say mixing because determining whether you allow a user to access /user/1 vs /user/2 is what authorization is for.

    Authentication is the process of determining “are you who you say you are”, whereas authorization is the process of determining “are you allowed where you want to go.”

    So far you’re using devise for Authentication, and you’ll want to take a look at grabbing another gem for Authorization (my preference is cancan.)

    If you don’t want to go the full authorization route (I’d recommend against it, but…) you can do a check in the before_filter of the user controller to see whether the current_user_id == id_from_the_url.

    And to redirect after login you’ll want to use the devise hook after_sign_in_path_for which will look similar to this:

    class ApplicationController < ActionController::Base
        def after_sign_in_path_for(resource)
            return user_path(resource)
        end
    end
    

    Source: https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in

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

Sidebar

Related Questions

I am using the devise gem for authentication and have the following before_filter in
I have already created a User Model using devise, but I now want to
I have a rails application, and I authenticate users to the application using Devise.
Recently I have changed my authentication system to devise. I want to migrate my
I have a perfectly working rails application including devise authentication. I created a second
I'm using the devise authentication plugin under rails 3. At the moment, I have
I'm using the devise authentication plugin under rails 3. At the moment, I have
I'm using Devise for user Authentication and have the following failing Cucumber scenario: Scenario:
I have a Rails 3 application using Devise for authentication. In addition to the
I have an app that is using devise for authentication. Rails 3 on ruby

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.