Forum: Rails deployment How to validate presence of phone number or mobile phone

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
65f3f8f9e49328855297ad1590461acf?d=identicon&s=25 Thriving K. (thriving)
on 2009-09-28 13:49
In my model of user.rb

there are phone number and mobile number.

i want to validate if phone number and mobile number are exist or
not(not neccessary to do both).

how to do that
6cd7e03644176cfa8ca0688075457f1d?d=identicon&s=25 Smit Shah (smit_shah)
on 2009-09-29 13:03
Thriving K. wrote:
> In my model of user.rb
>
> there are phone number and mobile number.
>
> i want to validate if phone number and mobile number are exist or
> not(not neccessary to do both).
>
> how to do that

Write following code in model.

validates_presences_of :field_name
This topic is locked and can not be replied to.