Allo,
Just started playing around with RoR/scaffolding and have been
impressed so far. However, it seems to create a 1:1 relationship
between Controllers and Models and the basic CRUD actions – I need to
CRUD two models from the same views and actions.
I have:
Book model
Book controller, with create/edit/show/destroy/list actions and the
scaffold-gen’ed views.
Category model
Category controller, with create/edit/show/destroy/list actions and
the scaffold-gen’ed views.
I’d like to have:
Book model
Admin Controller, with create/edit/show/destroy/list actions for both
models
Category model
I want to essentially combine the Controllers and views into one so
that when you create/edit/show/destroy a Category you can also create
the Books from the same views/actions.
I’ve added the appropriate belongs_to and has_many relationships to
each model (and the table pk/fks are in place):
Book
belongs_to: category
Category
has_many: books
Thanks