(sorry for the double post, somehow I accidentally prematurely posted
part of this....)I'm building a simple support ticket system for use in our office. I've
got a model called Ticket and one called Category and I'm trying to set
it up so that I can add categories at will and assign many categories to
a single ticket.I'm trying to use the has_many :through association to accomplish this,
but I've run into an issue.Here's the basic setup:
class Ticket < ActiveRecord::Base
has_many :categoryassociations
has_many :categories, :through => :categoryassociations
end
if you say :categoryassociations, rails assumes your model is Categoryassociation. You need :category_associations for it to look for CategoryAssociation
class CategoryAssociation < ActiveRecord::Base
belongs_to :ticket
end
this is missing a belongs_to :category.
Fred