title: In Rails when a resource create action fails and calls render :new, why must the URL change to the resource's index url?
body: <p>I have a resource called Books.  It's listed as a resource properly in my routes file.</p>
  
  <p>I have a new action, which gives the new view the standard:</p>
  
  <pre><code>@book = Book.new
  </code></pre>
  
  <p>On the model, there are some attributes which are validated by presence, so if a save action fails, errors will be generated.</p>
  
  <p>In my controller:</p>
  
  <pre><code>@book = Book.create
  ...  # some logic
  if @book.save
    redirect_to(@book)
  else
    render :new
  end
  </code></pre>
  
  <p>This is pretty standard; and the rationale for using render:new is so that the object is passed back to the view and errors can be reported, form entries re-filled, etc.</p>
  
  <p>This works, except every time I'm sent back to the form (via render :new), my errors show up, but my URL is the INDEX URL, which is </p>
  
  <pre><code>/books
  </code></pre>
  
  <p>Rather than </p>
  
  <pre><code>/books/new
  </code></pre>
  
  <p>Which is where I started out in the first place.  I have seen several others posts about this problem, but no answers.  At a minimum, one would assume it would land you at /books/create, which I also have a view file for (identical to new in this case).  </p>
  
  <p>I can do this:</p>
  
  <pre><code># if the book isn't saved then
  flash[:error] = "Errors!"
  redirect_to new_book_path
  </code></pre>
  
  <p>But then the @book data is lost, along with the error messages, which is the entire point of having the form and the actions, etc.  </p>
  
  <p>Why is render :new landing me at /books, my index action, when normally that URL calls the INDEX method, which lists all the books?</p>