Topic: Rendering "New" View With Validation Errors With Potential for Nesting
Much like the code in the thread here http://railsforum.com/viewtopic.php?id=23294 expect this is the create action (ignoring xml for clarity):
@result = Result.new(params[:result])
respond_to do |format|
flash[:notice] = 'Result created.'
render :action => 'new'
This works well if @result is saved, but if there are errors, the page is rendered properly but the nested url is lost (/results/new vs /users/:user_id/results/new). Is there a way to refactor this to retain the url when there are errors? A redirect_to won't work because the @result object is lost.