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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:09:05+00:00 2026-05-16T20:09:05+00:00

I have a couple of objects in a Rails app (Ticket, and Comment) class

  • 0

I have a couple of objects in a Rails app (“Ticket”, and “Comment”)

class Ticket < ActiveRecord::Base
  has_many    :attributes
  has_many    :comments
end

class Comment < ActiveRecord::Base
  belongs_to :ticket
  belongs_to :user
end

with the following schema:

create_table "comments", :force => true do |t|
  t.integer  "ticket_id"
  t.integer  "user_id"
  t.text     "content"
  t.datetime "created_at"
  t.datetime "updated_at"
end

create_table "tickets", :force => true do |t|
  t.integer  "site_id"  
  t.integer  "status"
  t.integer  "user_id"
  t.datetime "created_at"
  t.datetime "updated_at"
end

However, for some reason – whenever I do a @lead.comments I get a crash:

can't convert String into Integer

Any ideas? This is driving me nuts!

  • 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-16T20:09:05+00:00Added an answer on May 16, 2026 at 8:09 pm

    I think the line that’s causing you pronlems is:

    has_many :attributes
    

    “attributes” is a special word in an Active Record. It refers to the values of the columns in the db.

    If you try and override this with an association, then you will have problems.
    My suggestion is that you should not have a model called an “attribute” – call it something else, eg “properties”, and the problems will go away.

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

Sidebar

Related Questions

Say I have a couple of basic objects like so: [Serializable] public class Base
I have a couple of complex objects that I'd like to compare properties on.
Image a couple of objects for which one property can have 3 possible values.
So I have deployed my app to heroku for testing for a couple of
I have a couple of basic Rails problems that I'm having trouble finding relevant
I have couple of objects(1 custom object called appointment and event object) which i
I'm wondering if this is even possible. Basically I have a couple objects that
I have a couple of simple objects that have a many-to-many relationship. Django has
I have a couple of models that are composites of multiple objects. I basically
I have a couple of Django models set up like this: class Group(models.model): name

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.