views:

17

answers:

1

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?

A: 

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

Bohdan Pohorilets