I wanted add a hook on before_save. Validation happens before "before_save" is called, so I moved it to before_validation :on =>:save.
Now the problem is, when I do @object.save_without_validation (sometimes I had to use this). my before_validation hook doesn't get called.
Am I missing something or is there a more robust way of adding a before hook that works for both cases?
Hi when you save an object you have next callbacks
* before_validation
* after_validation
* before_save
* after_save
* before_create
* around_create
* after_create
try to place your code inside after_validation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With