Forum: Ruby on Rails Validations Doubt

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.
A2f8d7744d5373bb8d88667ae0bea8c5?d=identicon&s=25 kumar (Guest)
on 2006-05-03 12:39
Hi to Ruby and Rails group!

I am new to the ROR .

I ahev some doubts

1.Can we write the reguller expressions controller!

2.I have added the  some controles in the rhtml file.(with out database
fileds)

  I want  to wirte the validations  for these text fields in the model

  Is it Possible?


Give me any reference?


3.In how many ways can we write the validations?


Thanks and Regards,
Kumar
A2f8d7744d5373bb8d88667ae0bea8c5?d=identicon&s=25 kumar (Guest)
on 2006-05-03 13:37
kumar wrote:
> Hi to Ruby and Rails group!
>
> I am new to the ROR .
>
> I ahev some doubts
>
> 1.Can we write the reguller expressions controller!
>
> 2.I have added the  some controles in the rhtml file.(with out database
> fileds)
>
>   I want  to wirte the validations  for these text fields in the model
>
>   Is it Possible?
>
>
> Give me any reference?
>
>
> 3.In how many ways can we write the validations?
>
>
> Thanks and Regards,
> Kumar


Hi I  have also same doubt ,can we write the validations  for non
database fileds
 in model

Please give me reference

Thnks
A0ed1bbfe42f4f87e6db0a16706246e2?d=identicon&s=25 Michael Greenly (mgreenly)
on 2006-05-03 16:43
> Hi I  have also same doubt ,can we write the validations  for non
> database fileds
>  in model
>
> Please give me reference
>
> Thnks

Yes you can I did just that in this peice of code

http://www.metaspot.net/gms/browser/trunk/app/models/user.rb
9d1f5d2d9de70bd9a934f557dc95a406?d=identicon&s=25 Daniel ----- (liquid)
on 2006-05-03 19:07
(Received via mailing list)
There is many different validations that are available to you out of the
box.

The one for use with regular expressions is
validates_format_of
docs at
http://api.rubyonrails.org/classes/ActiveRecord/Va...

If none of those meet your exact needs you can always write your own
with
the validate method
This topic is locked and can not be replied to.