Validations Doubt


#1

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


#2

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


#3

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/Validations/ClassMethods.html#M000817

If none of those meet your exact needs you can always write your own
with
the validate method


#4

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