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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:12:44+00:00 2026-06-06T01:12:44+00:00

Hi clever programmers, I’ve been searching and reading a couple days, but I need

  • 0

Hi clever programmers,

I’ve been searching and reading a couple days, but I need some Rails help-

Here is my goal: I want to make a multi-page profile for each user, and I’d like to handle this profile with a profile controller.

The problem? How do I make the ‘show’ REST action apply to an entire controller instead of just one page? Specifically, how can I have both a @current_user and a @user variable available in the Profile controller that correspond to the signed-in user and the current user’s page.

I’m not sure if I should be making routes with multiple :id s in the route or if there is some way to persist the signed-in-user in something like @current_user when they sign in that is just available everywhere and then I would use the :id of the user who’s profile it is in the route. I’m pretty sure facebook does something like facebook.com/{your_id}/{their_id}/ for example.

I tried accessing @current_user from my session_helper.rb class but it came up nil and I’m not sure how to pass the :id to use User.find(params[:id]) because the profile controller is not affiliated with the resource for the User model.

Any protips or links to helpful readings would be much appreciated. I’m a beginner so feel free to suggest a better course of action if I’m going against the rails way. Thanks in advance!

  • 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-06T01:12:46+00:00Added an answer on June 6, 2026 at 1:12 am

    You may not know but you can store session data, and user_id it’s really common thing that people saves on it.

    So for saving at the sign in

    session[user_id] = ....

    Then you could have something like this on a helper
    def current_user
    User.find(session[user_id]) if session[user_id]
    end

    You should check the gem called devise. It provides all the functionality for aunthentication and it also provides a current_user method everywhere. You should check it at least to see how they have implemented that method.

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

Sidebar

Related Questions

Simple query, possibly impossible but I know there are some clever people out there
I need some clever logging library for a daemon-like C (not C++ ) program
Hopefully some clever lad or ladette can help me figure out the logic for
I need to figure out some clever MySQL snippet that will allow me to
I had thought I was clever. But in light of recent discoveries, I'm not
What are some clever (not ordinary) ways of implementing data structures in C, and
I'm wondering if there's some clever way in MySQL to return a mixed/balanced dataset
Possible Duplicate: Favorite (Clever) Defensive Programming Best Practices I am always advised by some
Is there some clever content-type setting that makes Firefox display highlighted HTML source code
By clever, I mean NOT TO upload once again the files that has been

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.