On Wed, Nov 3, 2010 at 7:07 AM, Premanshu Mishra <[email protected]>wrote:

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

Always in the models. You can do client side (browser Javascript)
validations but those should only be in addition to server side for
security. Controllers should be kept as lean as possible and used for
directing traffic, not "business logic" such as validations.

See: http://edgeguides.rubyonrails.org/3_0_release_notes.html

>
> 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
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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