Hi
I have done this so far…
First of all I installed Active Scaffold
- Created a model for a table named products (modelname: product)
- Run rake db_migrate so I have a nice table with a bunch of fields
- Created a model for a table named categories (modelname :category)
- Now I want a small tiby and nice looking subform on my create new
product page where my client can choose to which category this product
belongs to. - So I create a migration to add a table for the relations to be stored
in - So I open up the model file and write for product.rb
has_many :products_categories
has_many :categories, :through => :products_categories - And I open up the category.rb file and adds
belongs_to_and_has_many :products - Nothing works! Please help me!
–
Andreas Kviby
Telefon 070-352 66 76
E-post [email protected]