Server side Validation

Hi,

Does RoR provide logical validation on the server side ? Eg checking
whether the amount in a particular field is the correct sum or product
of some other fields or if the value between 2 fields have some
relation, eg they are unequal etc. If there is an error, how is it
displayed, is a flash[:message] the best method ?

Thanks

atul

On 10 Jan 2008, at 16:53, Atul G. wrote:

Hi,

Does RoR provide logical validation on the server side ? Eg checking
whether the amount in a particular field is the correct sum or product
of some other fields or if the value between 2 fields have some
relation, eg they are unequal etc. If there is an error, how is it
displayed, is a flash[:message] the best method ?

There are a bunch of validations you can use on your models
(validates_format_of, validates_inclusion_of etc…) and it’s not hard
to right your own/customise it.

error_messages_for is often a decent enough presentation of errors,
but you could also iterate over model.errors and display them whatever
way you want

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs