Many-to-many error

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?

On 7/7/06, Geoff D. [email protected] 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?

Chuck V. wrote:

On 7/7/06, Geoff D. [email protected] 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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs