views:

74

answers:

1

Hello,

I need to have two separate pages on the site I'm planning to build that are very similar that I don't need to introduce new DB tables or models. I would also like to stay RESTful.

If I'm to use the same controller/model I will need to have new methods other than standard index, new, edit...etc which makes it non-restful or I will have to have a variable on page that identifies it and then inside each method I will render different view accordingly.

Another idea I got was to have separate controller and model but use the same DB tables and enforce the model to use the table although it doesn't match the convention.

I'm guessing there might be cleaner way to do this. Do you know any? if not which way do you suggest?

Thanks,

Tam

+1  A: 

I'm not afraid of the restafarian police! Sometimes your controllers need more than the 7 actions (where's the get to confirm a delete, eh?), sometimes they will need less. That's just the way it is when you start to create real world software.

If the actions you're adding are not coherent with the actions that exist (for example off by just a little bit but still off in most actions), then we're talking about a new controller IMO - otherwise adding a few actions where you need to is ok in my book.

Andy Gaskell
I agree with you. In a lot of cases you do need more than 7 action or things will get complicated inside the controller by using parameters and parse them inside
Tam