On Nov 3, 2010, at 9:07 AM, Premanshu Mishra wrote:

Hi,

I wanted to know where validations placed are most effective: Model,
View or controller.

In my application i enter data in a text box and if it is greater than a given value (which varies depending on choice), it should throw an error
message and data shouldn't be saved.

Thanks,
Premanshu

You've answered your own question here. The Model is responsible for saving data back to your persistence store (whatever that is) so that is the logical place for validations to live. More than one controller can access and send data to your one and only model, they should never repeat your validations there (DRY).

Walter

--
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