I've generated model, controller and then I've added validation to my model. When I leave my form field empty validation doesn't appear (validate_presents_of). How can I fixed it??
on 2007-04-09 13:07
on 2007-04-09 13:37
on 2007-04-09 14:19
Yes it's validates_presence_of
on 2007-04-09 14:30
what do you mean by 'when i leave my form field'? i have a feeling you are misunderstanding record validation. record validation != form validation record validation occurs when you attempt to save your record to the database after you have submitted the data to the server. if you want to validate the form data before you submit, you will have to write your own functionality to validate it on the page.
on 2007-04-09 22:37
I'd like to have the same type of validation like I have when I'm using scaffolding. Simple validation of presence something on my form field.
on 2007-04-10 00:56
Daniello wrote: > I'd like to have the same type of validation like I have when I'm > using scaffolding. Simple validation of presence something on my > form field. Hey Daniello, Why dont you show us the source of model + controller + view that you use? Gokhan www.sylow.net
on 2007-04-10 01:05
you create a form based on your model. submit the data, attempt to save it. if validations fail, the record won't be saved and will contain errors. you redisplay your form and show your users where the errors were made in the form data. if the record saves, then all is good. it's a bit much to explain in the mailing list. i suggest you review the generated scaffolding code and read the Rails book if you can. also, google is your friend.