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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:33:15+00:00 2026-06-05T14:33:15+00:00

I have two models in my Ruby on Rails app: User and Bookcase. I’ve

  • 0

I have two models in my Ruby on Rails app: User and Bookcase. I’ve provided an edit link for each Bookcase, but when I click on these links, I encounter an error:

ActiveRecord::RecordNotFound in BookcasesController#edit
Couldn't find User with id=19

(Note that it’s asking for the User Id. Also, it’s worth noting that Bookcases belong_to Users.)

Here’s the snippet I used to create the link:

<%= link_to "edit", edit_bookcase_path(bookcase.id) %>

If you need any further code, let me know and I’ll post it!

  • 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-05T14:33:16+00:00Added an answer on June 5, 2026 at 2:33 pm

    From what I can tell of what you have asked, if you are in the BookcasesController in the EDIT method, you shouldn’t be calling for the User, you should be calling for the BookCase, like so:

    @bookcase = BookCase.find(params[:id]) // WHAT YOU WANT
    

    It seems the you have this code instead, which is giving you the error:

    @bookcase = User.find(params[:id]) // NOT WHAT YOU WANT
    

    This will return the BookCase with the id 19, which should belong to a user. If you need to then access the user that the book belongs to, you could do so like this:

    @user = @bookcase.user
    

    Also, you can just use the edit link like to, without the id call:

    <%= link_to "edit", edit_bookcase_path(bookcase) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a site in Ruby on Rails, I have two models a
I currently have a Rails 3.0.10 app and I made two models with simple
I'm using Ruby 1.8.7 and Rails 2.3.8 I have two ActiveRecord Models, A and
ruby 1.9.2p290 rails 3.1.1 Basically I have two models: CHEFS and RECIPES. class Chef
ruby 1.9.2p290 rails 3.1.1 I have two models: RECIPE and RECIPE_CATEGORY with belongs_to and
I have two models: User and Car with the following associations: User has_many Car
I have two models User and Category that have a HABTM association. I would
I have two models, user and group. I also have a joining table groups_users.
I have a two models, Group and User User belongs_to Group and Group has_many
I have two databases in use in a Ruby on Rails application; one is

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.