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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:59:27+00:00 2026-05-25T02:59:27+00:00

I have a table which list a set amount of managers. In the Manager

  • 0

I have a table which list a set amount of managers. In the Manager User Id column I am trying to get the name to appear instead of the integer. I have the following relationships

User model

has_many :roles, :through => :roles_users
  has_many :projects, :foreign_key => "manager_user_id"

Projects

class Project < ActiveRecord::Base
  belongs_to :user, :foreign_key => "manager_user_id"

Index.html.erb

    <tr>


  <td><%= project.project_number %></td>
  <td><%= project.project_name %></td>
  **<td><%= user.project.manager_user_id%></td>**
  <td><center><%= link_to image_tag("icons/user.png"), project %></center></td>
  <td><center><%= link_to image_tag("icons/user_edit.png"), edit_project_path(project) %></center></td>
  <td><center><%= link_to image_tag("icons/user_delete.png"), project, :confirm => 'Are you sure?', :method => :delete %></center></td>

    </tr>

I have tried the following:

  • project.user.manager_user_id
  • user.project.manager_user_id

Neither of these work and I get this error: undefined local variable or method `user’ for #<#:0xb14cf5c>

What is it that I am doing wrong. I used the above similar method for another table and this worked fine.

  • 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-25T02:59:28+00:00Added an answer on May 25, 2026 at 2:59 am

    It looks from your view that you have project defined in the view, but not user. That being so, you definitely want the project.user form. That also makes sense in that a Project only has one associated User, whereas a User has multiple Projects, so user.project is an array.

    Secondly, remember that manager_user_id is a member of Project, not of User, so project.user.manager_user_id won’t work.

    I suspect you want something like project.user.name.

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

Sidebar

Related Questions

I have a table articles that has a column company which has list of
I'm trying to keep my HTML very simple. I have a set list which
I need to have one table in which i can set user preferences I
I have a table which holds a list of criminal charges.These charges can be
I have a table which contains a list of products for a company. They
Ok I have a Project_Assigned table which contain a list of account_ids assigned to
I need to display a list of dates, which I have in a table
I have a table which is viewed by the user. As the user shakes
Lets consider I have a table 'Tab' which has a column 'Col' The table
I have a categories table which is set up to allow an infinite number

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.