The model does a validates_presence_of for each field, so if a user
fails to enter one or all fields, it will fail validation and redirect
back to the form.
This works perfectly, but unfortunately, if a user spends 30 minutes
writing a new post, but forgets to fill out a field, they get
redirected back to the form but loose all the content that they had
typed in!
Any advice on how to go about passing the form data BACK to the form
after it fails validation?
The model does a validates_presence_of for each field, so if a user
fails to enter one or all fields, it will fail validation and redirect
back to the form.
This works perfectly, but unfortunately, if a user spends 30 minutes
writing a new post, but forgets to fill out a field, they get
redirected back to the form but loose all the content that they had
typed in!
Any advice on how to go about passing the form data BACK to the form
after it fails validation?
In your view, use the params hash to supply the values to the form
fields:
This is for when you use a form_tag. I just did some experimenting, and
it appears to happen automatically when using form_for. I don't know if
it actually is or if I've got something wonky going on.