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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:21:00+00:00 2026-06-10T10:21:00+00:00

I have a User model (generated by devise) and a Submission model in a

  • 0

I have a User model (generated by devise) and a Submission model in a Rails project. I’ve added a field called ‘full_name’ to the user model. Also, there is a field for ‘user_id’ in the submission model.

I want to show the the full_name of the user associated with the submission on the submission show page. Right now it shows the user_id from the submission model just fine.

The User model I have this:

class User < ActiveRecord::Base
  has_many :submissions
  devise :database_authenticatable, :registerable,
     :recoverable, :rememberable, :trackable, :validatable, :confirmable

  attr_accessible :email, :password, :password_confirmation, :remember_me, :full_name, :role_id

  validates_presence_of :full_name
end

This is the model for submissions:

class Submission < ActiveRecord::Base
  belongs_to :user
  attr_accessible :description, :title, :user_id
end

This is in the controller:

  def show
    @submission = Submission.find(params[:id])
    @user = User.find(params[@submission.user_id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @submission }
    end
  end

What I get when I try to use this line in the view:

<%= @user.full_name %>

I get this error:

Couldn't find User without an ID

I’ve tried several variations and can’t quite figure out what should be in the place of:

@user = User.find(params[@submission.user_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-10T10:21:01+00:00Added an answer on June 10, 2026 at 10:21 am

    Assuming that you’re populating the data correctly, you only need the following once you have looked up the submission.

    @submission.user

    If you think that the data is OK, then try the following in the Rails console.

    > Submission.first.user

    What do you see there?


    The specific error that you are seeing is because this:

    params[@submission.user_id]

    is unlikely to ever have anything in it. If the user ID is “1” (for example) then you’re asking for the value in the params hash that corresponds to the key “1”.

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

Sidebar

Related Questions

Let's say I have User model and Post model. Post model contains field user_id
I have a user model that is generated using Devise. I am extending this
In my Rails 3 app, I have a model called User with id and
My Rails 3.2 project has a devise-generated user and a set of models that
I have generated a User model along with 2 other accompanying models called Update
I have a User model and a Submission model. Each Submission has a ForeignKey
UPDATED I'm using Devise 1.4.9 for authentication and my Devise-generated User model doesn't seem
I have a User model that Devise manages - i.e. all users have email
I already have set up Devise to My App. So User model is already
I have a very simple issue: User model: class User < ActiveRecord::Base devise :database_authenticatable,

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.