I have a model with amount parameter that have to be greater than zero. My form asks a user for a number to subtract from the model's amount. How do I validate my model after subtracting the number from amount?
Example: right now the amount is 50. User input is 51. 50-51 = -1 which is less than 0. Validation should fail.
Right now my operation looks like this, but it validates only user input, not the final model:
step :model!
step :new_amount!
step Contract::Build()
step Contract::Validate()
step Contract::Persist()
我在合同内使用反序列化器首先减去了价值。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.