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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:58:50+00:00 2026-05-22T19:58:50+00:00

I am having trouble accessing the id from a hash: @categories = Category.includes(:discussions) The

  • 0

I am having trouble accessing the id from a hash:

@categories = Category.includes(:discussions)

The data is returned from the above.

<li class="category">
<h3><%=link_to(category.title, category.title)%></h3>
<%=link_to(category.discussions.first.title, CGI::escape(category.discussions.first.title), :class => 'category_discussion_latest')%>
Most recent by <%=link_to(category.discussions.first.comments.first.user.name, category.discussions.first.comments.first.user, :class => 'category_commentby_latest')%>
<span class="category_discussiondate_latest"><%= category_date(category.discussions.first.comments.first.created_at) %></span>
Discussions: <%=category.discussions.count%>
Comments: <%=category.comments.count%>
<div class="clear"></div>
</li>

This is my partial that renders the list.

However you may notice on the links at the moment I simply have category.title in the url section of link_to this is because if I state:

<h3><%=link_to(category.title, category.id)%></h3>

It returns:

undefined method `model_name' for Fixnum:Class

I am new to rails and i am sure this solution is simple but I just can’t see it as I have been staring at the same code for too long. Thanks!

  • 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-22T19:58:50+00:00Added an answer on May 22, 2026 at 7:58 pm

    Please see the documentation for link_to. Passing an integer in as the second argument is not valid. You could pass a url (as a String) or an ActiveRecord model object, like this:

    <h3><%=link_to category.title, category %></h3>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble importing and accessing a private key with the ASPNET user.
I'm having trouble accessing the content of QNetworkReply objects. Content appears to be empty
I'm having trouble accessing the some string fields in a COM interface. Calling the
I'm having trouble accessing the id , area and theme values in my ViewData.
I am having trouble accessing the document in my firefox extension. I am trying
I'm having some trouble accessing attributes like DURATION and DATE_MODIFIED of video and image.
I am having trouble accessing the attributes of a join in Rails3. There is
I am having trouble accessing two of my variables. I have looked on the
Having trouble linking the Stomp.framework into an iPhone SDK application. http://code.google.com/p/stompframework/ I follow the
Im having trouble using a .NET COM in vb6, It compiles ok and I

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.