I am building small app that will only display products in various categories. And will never display categories without products.
So far I have two models – product and category and wondering if I really need controller dedicated to category model? I can only see one advantage so far – rendering collection (partial) of category. But it could be done via product as well. I want to keep the code as small as possible. Just wondering what is the best approach in such situation, what about routing and resources in rails 3?
Thanks a lot for any suggestions.
I am building small app that will only display products in various categories. And
Share
I think you should keep the controller for the following reasons:
1) Maintenance of categories, basic CRUD functionality may need to be implemented so this will be required.
2) If anyone else has to maintain the code at a later date it is much easier for them if all the basic details are as expected. Finding a controller missing would probably start to raise a developers suspicions as to what other oddities there will later uncover.
3) How much smaller will not including the controller make it? Its not going to be a vast difference and so for clarity it is probably best to include it.