conditional validation

Hi,

How can I validate user info under certain conditions? For example, I
just downloaded a plug-in that allows me to validate phone numbers,
but what I would like is to only validate the phone number if it is
not blank and if the user_type_id field is equal to one.

How can I achieve such a validation in my user model?

Thanks, - Dave

this is not tested, but I think you can do something like this:

  validates_format_of :number, :with => /[0-9]/, :if => some_method?

Thanks. How do I pass arguments to "some_method"? I am concerned if
the :phone_number attribute of the model is not empty and if
the :user_type_id field is equal to 2.

- Dave