Hey All,
Is it possible to have multiple entries for the :on option for the
‘validates’ validation?
Something like the following:
validates_format_of :some_user_attribute, :with => /
some_reg_ex/, :on => [:create, :update, :some_other_action]
Basically I would like to run one particular validation when multiple
actions are called in the controller. For example, I would like to
validate some user info on the ‘create’ action, on a ‘update’ action,
and possibly some other actions as well. I have found that I can do
it if I just copy the line above and have three separate ‘validates’
entries however it seems as though I’m just repeating myself.
Also, if there is a easier way of doing this, that’d be great too!
Thanks in advance!