Reputation: 23
I found this but it didn't answer my question. Say I have a Payment model, and PaymentConroller. I have the ability to create one payment, edit it, update etc... I also have a method payment_wizard. This method spreads payment according to parameters given in 'payment_wizard' form. But, I want a clean form when I spread new payments, to be able to update an existing collection of payments, and destroy all of them at once. This is making me think that the "right" thing to do would be to create a new controller PaymentWizardController which does all that.
Is this the right way to do this?
Upvotes: 0
Views: 65
Reputation: 2390
The best approach in my opinion is to keep all your controllers RESTful. Managing a collection of payments could be done by creating a PaymentCollectionController
(or however you call it) with update
and destroy
actions.
Just as is mentined in the question you linked, you don't need a model for every controller you have. Keeping them RESTful is following a convention which makes your code more readable for other users.
Upvotes: 1
Reputation: 5812
Think about controller as a handler of actions which are available for user to visit on your site. Do you really need this payment_wizard controller? Try to create some functions in service for PaymenController to keep it slim.
Upvotes: 0