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

  • Home
  • SEARCH
  • 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 3878390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:36:27+00:00 2026-05-19T22:36:27+00:00

I recently decided I wanted to list all the users in my Ruby On

  • 0

I recently decided I wanted to list all the users in my Ruby On Rails application – since I couldn’t figure out how to list them any other way, I decided to use partials.
I have the following on my administration page (just hooked up to a its own administration controller):

<%= render :partial => User.find(:all) %>

I then have a file called _user.html.erb in my users view folder. This contains the following:

<ul>
<% div_for @user.object_id do %>
    <li><%= link_to user.username, user.username %></li>
<% end %>
</ul>

When the application runs and I go to the administration page, I get the following error:

undefined method `id’ for 4:Fixnum

It says it’s because of this line (which is in the partial file):

<% div_for @user.object_id do %>

I’m unsure why this happens (and have googled for hours to try and find results and only find solutions that don’t work for me). I think it’s something to do with my usage of the @user instance variable, but I’m not totally sure.

  • 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-19T22:36:27+00:00Added an answer on May 19, 2026 at 10:36 pm

    You get that error because div_for expects an active record object as an argument, which it calls the id method on. You pass in a fixnum (the result of @user.object_id), which is not an active record object and does not have an id method.

    So pass in @user instead of @user.object_id and it will work.

    Also you should use user instead of @user, rails 3 does not set instance variables for partials anymore.

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

Sidebar

Related Questions

I recently decided to learn and make small 2D game using XNA framework. So
I've recently decided to take on a pretty big software engineering project that will
I come from a Java background and recently decided to try creating a C++
I've been reading up on functional programming a lot recently, and I finally decided
I recently ran into this problem: Rails 3 link_to (:method => :delete) not working
I've recently found out about the DotLess library and I was so excited about
I have been recently introduced to the concept of BDD and am using SpecFlow
I typically have not worried at all about piracy or copy protection with software
Recently, I came across this one stone kills multiple birds framework - http://phonegap.com/ .
I'm developing a software layer that I would like to reuse several time for

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.