Probably something that many people had to do but that I can’t find any hints on internet!
Let’s say I have a model “Contract” that belongs to a “User”. The user has to accept the contract. Basically the “Contract” has few attributes, like “signature” that is an image and a “confirmed_at” date.
So far so good. Of course, there is a contract controller that render model attributes in JSON for my website, and also an HTML representation of this model.
The problem is that I want to show a “politic contract” from those informations. I want to show a long text with those informations that doesn’t necessarily belongs to user. Let’s say I only need “Contract” model to render that politic, but it’s not part of “Show” action in ContractController because it’s used to other calls AND I want other resources to render the politic contract.
Should I create another action to this controller by passing the contract ID as param? Should it be a completely new controller that its responsabilities is to render many type of contracts (because there are many)? Should I create a new “format” instead of HTML and JSON to use “respond_to”?
Because right now I have also long texts for “terms” and another one for “conditions” and was thinking of it was a good idea to group them.