[email protected] wrote:

> The last assertion fails, saying the response is a 200 instead of a
> redirect. 

Standard rails behaviour is not to redirect if the update fails.

If you redirect on failure, the submitted modifications in the form gets 
over-written. So say you modify a blog altering a large paragraph of 
your master work. However, you also accidentally delete the blog title 
and that causes a validation failure. What you want then is for the 
rendered form to contain the data you submitted, not the content as it 
is in the database. Redirecting to edit will pull the data from the 
database again and populate the form with that, thereby losing the 
changes the user is trying to submit.

Also you'll get a fresh object - one without the error data. So you 
won't have anything to populate the error report with. What needs to be 
passed back to the form, is the same object that failed to save.

That's one of the down sides of separating the edit and update methods - 
because you end up with both having to be able to handle the form 
rendering.

-- 
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].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to