According to the MVC standard, all logic, mainly related to database, should be placed in the Model.
Consider the MVC standard as a computer. The Model is the CPU, the View is your monitor and the Controller are the ports / cables.
Views have no logic, just like your monitor. It’s dumb, just displays what the controller (cables / ports) sends to it.
Controllers contain as little logic as possible, as well as cables and ports: They’re just what connects Views and Models.
Models, like the CPU, do all the heavy lifting: it is responsible for any light or heavy logic (the most common being persistence). It is she who handles everything that the Controller sends to her; and the Controller sends it as it did, who will receive, treat, format and manipulate it will be the Model.
How does this link get to the template? I think it’s only fair to set this attribute in a before_save. As long as it’s just setting the value in an attribute.
– user5564