We've moved discussions to Discord

MVC design question

Brian Carpenter
My current implementation is working, but wondering if there is a design approach that better conforms to rails standards to accomplish the following:

I have a model "ContractTemplate" that represents boilerplate terms for a business contract.

I have a model ClientContracts that represents executed contracts with clients.

Requirements
1. A user (lawyer) can edit a ContractTemplate record, make modifications and then the modified version is used to create a new ClientContract record without changing the original template.  (No attachments,  all JSON.)

2. A user edits the contract template and saves changes to the template.

I've made this work by creating a secondary edit flow for ContractTemplates and sending the save action to account_contacts#new.

My concerns
Sending an edit action to the create action in a different controller feels like bad design.

But, creating a helper method, or service to replicate a standard controller action (create) seems like bad design also.






Brian Carpenter
Just found this gorails tutorial that walks through creating multiple submit buttons on a forms with different actions.
https://gorails.com/episodes/forms-with-multiple-submit-buttons
Brian Carpenter
Also, adding this Ryan Bates railscast because it's helpful.
http://railscasts.com/episodes/163-self-referential-association
Notifications
You’re not receiving notifications from this thread.