RoR Design Question
I'm having some trouble figuring out how to break a project into various
controllers. Here's my situation. Say I'm building a small web store
that sells software. Each piece of software will belong to a given
Ok, so there are my two models 'Software' and 'Vendor'. I'd like to be
able to do basic CRUD on both a Vendor and and or a Product. However, I
want the Vendor to be a sort of Gateway to the Product. So let's say I
create the basic CRUD actions for the Vendor. If I'm viewing a Vendor's
info--name, address, url, etc-- that's where I would also see options
like: 'List Products', 'Create Product'.
So the real question is should I use one controller or two controllers?
If I used one controller I would have actions like:
If I used two controllers:
I'd go with two controllers for this purpose. Since you will probably end up adding more methods for each controller and if you put it all in one it will get huge.
me too. You should still keep the contorl somewhere to crud with individual controllers. You can mix and match things on your view pages as much as you want later. And if you're just starting your design, you might find later on that you actually would like to do it a different way, which would be more difficult if everything was already mixed together.