belongs_to :ticket_type, :foreign_key => :ticket_type
end
class TicketType < ActiveRecord::Base
attr_accessible :description
has_many :reasons, :foreign_key => :ticket_type
end
I have read the "Kitchen" posting about the same error, the only problem
is i am using a description, not ID.
Changing the form just gives errors, any help would be greatly
appreciated.
Thanks!
If you have the foreign key column called ticket_type and also
belongs_to ticket_type, then when you do @reason.ticket_type how is
rails going to know whether you want the value of the column or the
associated object? Best to stick to the conventions and call the
column ticket_type_id.
By the way, when posting an error it is a good idea to tell us which
line is the line the error refers to (ie which is line 44 in this
case) in order to save us having to work it out ourselves.