TypeError Conversion on has_many relationship


#1

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!