So far I have only worked with information processing in Rails, companies, articles, products, etc. However there is something I have never done and curiously I do not find explicit information about it, but rather, directly in Ruby but not in Rails, clearly the operations must be the same, but the placement and treatment possibly different, going to the point, an example It would be easy to dynamically calculate the average grades of a student, taking into account that the first 3 notes each are worth 20%, and the final exam 40%, will pose more explicitly below:
Periodo1 //Tabla
----------------------------------------------
f.note_1 //field (20%)
f.note_2 //field (20%)
f.note_3 //field (20%)
f.final_examn //field (40%)
Promedio //Total
This occurs to me that could be done directly from the view:
<% @average %> = (<%= f.note_1 %>*(20%)) + (<%= f.note_2 %>*(20%)) + (<%= f.note_3 %>*(20%) + (<%= f.final_examn %>*(40%)
<%= @average %>
Although this may not be the most correct in the sense that the logic is not so recommended to do it from the view, I appreciate much can guide me and give me an example of how this part of Rails, Greetings!