requiring one field or another

I'm fairly new to Rails so I'm having some trouble with what is probably
an easy task. Any assistance would be appreciated.

I have two fields, I only have to have one of them filled in...

At the moment I'm working on some variation of

   validates_presence_of :foo, :if => "bar.empty?"

Verbatim, that will of course not work..


Tom, :if takes a 'block'

  validates_presence_of :foo, :if => { | your_model_instance }

as you can see, the block is passed the current instance, which you can examine - returning tru means the validation will take place.