Before before_validation callback

Hi,

I was looking around a bit and couldn’t find any callbacks that
executed before before_validation
The current problem with using before_validation is that it won’t fire
if I’m not using validations with #save(:validate => false) - which
makes sense. Before_save won’t suffice because I want these callbacks
to fire before validation on the occasions that I do use validation.
Just a sidenote, these callbacks are for normalizing some strings.

Right now, I can do an alias chain on #save and have my sanitization
methods fire before anything else but I was hoping for something
cleaner.

Thanks,
Keith

On 20 June 2011 00:19, keith [email protected] wrote:

Right now, I can do an alias chain on #save and have my sanitization
methods fire before anything else but I was hoping for something
cleaner.

I think in that situation I would put the normalization code in
before_save and write the validations so that they pass with the
strings un-normalized, secure in the knowledge that they will be
normalized before saving. This seems aesthetically ok to me as the
purpose of validations is principally to validate user input, and
there is nothing wrong with the user input even though the strings are
not yet normalized.

Colin