hey all. I''m trying to set up a many-to-many relationship with products and categories. I''ve got the product model (product.rb) set up: class Product < ActiveRecord::Base has_and_belongs_to_many :categories end and a similar one for category.rb And I''ve got the tables set up -- products, categories, categories_products But when I load, I get: undefined method `associate_identification'' for Product:Class. This error occured while loading the following files: product.rb Any thoughts? -- Posted via http://www.ruby-forum.com/.
On 7/7/06, Geoff Dougherty <geoffdougherty@yahoo.com> wrote:> hey all. I''m trying to set up a many-to-many relationship with products > and categories. > > I''ve got the product model (product.rb) set up: > class Product < ActiveRecord::Base > has_and_belongs_to_many :categories > end > > and a similar one for category.rb > > And I''ve got the tables set up -- products, categories, > categories_products > > But when I load, I get: undefined method `associate_identification'' for > Product:Class. > > This error occured while loading the following files: product.rb > Any thoughts?Could be a schema issue, what does your categories_products table look like? Should just be category_id, product_id. But this could be total crap, since it''s an undefined method error it may be something deep in the heart of rails that''s suddenly broken. Have you ever gotten this working before?
Chuck Vose wrote:> On 7/7/06, Geoff Dougherty <geoffdougherty@yahoo.com> wrote: >> And I''ve got the tables set up -- products, categories, >> categories_products >> >> But when I load, I get: undefined method `associate_identification'' for >> Product:Class. >> >> This error occured while loading the following files: product.rb >> Any thoughts? > > Could be a schema issue, what does your categories_products table look > like? Should just be category_id, product_id. But this could be total > crap, since it''s an undefined method error it may be something deep in > the heart of rails that''s suddenly broken. Have you ever gotten this > working before?This is my first go-round with a Rails app. The link table is set up with category_id and product_id. Does it need to be indexed or anything? -- Posted via http://www.ruby-forum.com/.