Forum: Ruby on Rails TypeError Conversion on has_many relationship

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Neil M. (Guest)
on 2009-04-28 19:16
(Received via mailing list)
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!
This topic is locked and can not be replied to.