Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COThanks for the answer! The reason why I think it should be done server-side is simply because there's too many rules and they actually change often. So leaving them in the app would be a bit hard to manage if I need to change something. Ideally only some fields would be editable, like X quantity, and if the user does this, then I automatically update Y to be double. I was even thinking storing the js text of each function in the db, if the product had some rules. and when you bring the product, it would bring this "rule" field,bring the text and somehow convert it into actual code to validate.
      singulars
    2. COIf the rules are so complicated that you want to store the entire functions, then I understand. I still think you should have validations in the models though, otherwise it can always be avoided. Instead of my approach with static ratios in the models, you could add another model called Rule which belong_to Product or even polymorphic associations to whatever model is in need of rules. That way the rules can be made dynamically but it still validated server side
      singulars
    3. COHow would this work when an application is in production? If I did have this model as you described, would this mean if one rule changes, I need to redeploy the entire app? (Let's say I have easy access to the server as it would be mine) would it be a matter of just changing one file in the system or much more complicated than that?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload