Answer the question
In order to leave comments, you need to log in
How to build a controller structure for pages of the same type?
I am making a website for an oil technical school. They want 30 pages of formulas, but with the ability to calculate. Those. the page should contain a description, a picture of the formula and a calculator with submission.
It's on rails, so I'm wondering how this can be organized? You can make 30 controllers, each will have 2 methods (show, calc) and two pages. But then it will be difficult to edit.
Okay, if each page is a record in the database, then how to add completely different logic to the pages and to the controller? Produce submit methods? Also not good.
Does anyone have any options? If there were 5 formulas, then I would not fool around, but would simply make semi-static pages. But 30 ... And if they want more? Brr ... By the
way, here's an example: https://mirurokov.ru/calculator-online/calculator...
Those. It's just a simple percentage calculator. Now imagine that you have a lot of such calculators, the calculations take place on the server (that is, not js), and the result is of a different type (table, graph, just a number).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question