![]() | has_many association display problem. |
|
07 Sep 2010, 11:00
Stordopoulos Dimitris (3 posts) |
First I would like to express my gratitude for this great book. It is a great way to study Rails. Now, to the point. I scaffold the product and category. And for them I want to make a simple association many-to-one association. A product that belongs to a category. And so I state the association in the models and through a join model. Catgorization.rb ( join table ): and Category.rb: I’d like to be able to chose which category every product belongs to. I tried railscast episode 57 but somethings missing. I get an undefined method error if I use I load the categories with this (in the _form.html.erb, rendering the _form.html.erb in the edit.html.erb): And in the end I try to also display the category name in the index.html.erb with this: |
| You must be logged in to comment |

