This example is about having a request from a customer where the seller can choose to make an offer to the customer.
The request is stored in a class named 'Request' and the offer is stored in the class 'Offer'.
The flow is:
The seller picks up a request from the request-list and is redirected to the Request.show-form.
Here he can choose, by a link, to create an offer using the data in this request.
Now the seller is redirected to the Offer.Create-form which is filled with data from the request.
The seller now can add and or change data and the either confirm or cancel this offer.
That's it.
My idea is that the Request-controller, after receiving the action, will take the ID of the request then calling a service, Offer_service, which in turn reads the request using the ID and then creates a new Offer-object. The service continues with filling this object with data from the request-object and then calling the Offer-controller to open up the create-form to let the seller complete the offer.
I want to know if I'm on the right way or if I'm missing something?
Of course, this is simple for you, experienced people but for me... I'm new and feel like beeing on deep water sometimes. I would appreciate every type of advices, tips etc. that can lead me forward.
Amendment.. You see, we want to keep request and offer independent of each other and if the seller wants to change some of the values from the request he will do that to the offer only. The values in the request should be unchanged. And more, the id of the offer should be stored in the request so you can jump directly from a request-form to the offer if wanted. And vice-versa an id to the request should be stored in the offer to make it possible to go back to request. But those links(id:s) should only be set if the offer is saved (confirmed). It is also a possibility that more processing should be done to the request-data before it is stored in the offer. An offer may also be constructed without a request behind and then there is no connection to the request. That's why I think a service should be good to keep request and offer independent of each other.