Hi

Thank you, that worked

On Mar 18, 1:20 pm, Andrew Timberlake <[email protected]>
wrote:
> On Tue, Mar 17, 2009 at 11:09 PM, Shuaib85 <[email protected]> wrote:
>
> > Hi all
>
> > I want to check the presence of either one of two fields for instance,
> > phone number or mobile number, if either one presents, allow the
> > submission of the form
>
> > validates_presence_of :phone, OR :mobile
>
> > any idea how to do it
>
> def validate
>   errors.add(:phone, "can't be blank") if phone.blank? && mobile.blank?
>   errors.add(:mobile, "can't be blank") if phone.blank? && mobile.blank?
> end
>
> or some variation of the above
>
> Andrew 
> Timberlakehttp://ramblingsonrails.comhttp://www.linkedin.com/in/andrewtimberlake
>
> "I have never let my schooling interfere with my education" - Mark Twain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to