Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails - are validations only for data from user input via forms?

My models produce a lot of values for attributes which the user can not specify in any forms.

Should I be specifying validations for those attributes to prevent any of my model logic creating dodgy values or is that something I should just check for in my tests?

like image 948
robodisco Avatar asked Dec 10 '25 04:12

robodisco


1 Answers

As well as being essential for confirming user input, Active Record validations also provide a useful DSL for specifying the intent behind your domain design.

like image 170
Toby Hede Avatar answered Dec 12 '25 20:12

Toby Hede



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!