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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:20:27+00:00 2026-06-14T18:20:27+00:00

So yesterday I asked a question about getting the projects for a current user.

  • 0

So yesterday I asked a question about getting the projects for a current user. Well I ran into an issue. See that thread here. So today I was working on displaying categories and tasks for the user along with any discussions. when I loaded up the page to view this I got:

NoMethodError in UsersController#show

undefined method `projects' for #<User:0xad5823f4>
Rails.root: /home/adam/Documents/Aptana Studio 3 Workspace/StartPoint

Application Trace | Framework Trace | Full Trace
app/controllers/users_controller.rb:25:in `show'
Request

Parameters:

{"id"=>"4"}

This is currently whats in my users#show method:

  def show
    @projects = current_user.projects
    @tasks = current_user.tasks
    @categories = current_user.categories
    @discussions = current_user.discussions
  end

the table names are projects, tasks, categories and discussions. I have no problem using this any where else so why am I seeing this error?

if you need more code I can show it. the error is pretty clear but again I use this type of call else where to display project specific information such as a projects categories or tasks. could it be something with my relationship between a user and categories, discussions, tasks and so on? because I do have user_id in each table that is listed in the show method, among others.

Also I thought of this, this morning since were on this topic: current_user seems wrong because if I click on Bobs profile I will see all my stuff no? should it not be something more specific to the users id?

  • 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-14T18:20:28+00:00Added an answer on June 14, 2026 at 6:20 pm

    Have you established the association in each model?

    class User < ActiveRecord::Base
      has_many :projects
    end
    

    Also be sure that current_user is actually a User object and not some thin proxy.

    Generally you need to distinguish between the session user and the displayed user. This is why names like current_user are harmful. I’d recommend using session_user to refer to the logged in user and @user to refer to the user being displayed.

    Some login systems define only a current_user method, but to alias this isn’t hard. It’s just defective by design in that case.

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

Sidebar

Related Questions

Yesterday my friend asked me a question about this query: select * from user
I asked a question yesterday about a problem that Im having with a program
I asked a question yesterday about namespaces that got answered, and so I tarried
This question is about a similar javascript scope problem that I asked yesterday .
I asked yesterday a question about css div positioning, now I solved my issue
I asked a question yesterday about a little app that I would like to
Yesterday I asked this general question about decimals and their internal precisions. Here is
I asked a question about bigints yesterday which was kindly answered. However, I have
I asked a question about different testing frameworks yesterday. This question can be found
I asked a question about making a greatest n per group type query yesterday

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.