Many to Many Relationship problem

2008-06-18 Thread ibnesayeed
Hi, I am new to Rails. I am trying to stablish many to many relationship between Books and Categories. Following are the Models. --- class Book ActiveRecord::Base has_many :book_categories has_many :categories, :through = :book_categories end --- class Category ActiveRecord::Base

Re: Many to Many Relationship problem

2008-06-18 Thread Giorgio Clavelli
I'm not an expert and I try a long shot. Have you set the foreign keys (1 to many to BookCategories from both Book and Categories), when you created the tables by the migrations? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Many to Many Relationship problem

2008-06-18 Thread ibnesayeed
Following is the schema of the tables. ActiveRecord automatically automatically maps them using the category_id and book_id present in intermediate table book_categories. Any idea why i am getting the error, ArgumentError: A copy of Category has been removed from the module tree but is still

Re: Many to Many Relationship problem

2008-06-18 Thread alphamule
shouldn't the BookCategories class be called BookCategory? eric. On Jun 18, 9:43 am, ibnesayeed [EMAIL PROTECTED] wrote: Following is the schema of the tables. ActiveRecord automatically automatically maps them using the category_id and book_id present in intermediate table book_categories.