title: How to declare a rails resource with a parameter for new action?
body: <p>I have a model named <strong>Entree</strong> for which the <code>new</code> action needs a parameter, the id of another model named <strong>Cave</strong>. I don't want to nest Entree in Cave since Cave is already nested.<br>
  What I did was declaring the resource Entree as follow in <code>routes.rb</code>:</p>
  
  <pre><code>resources :entrees, :except =&gt; [:new]
  match "/entrees/new/:id", :to =&gt; "Entrees#new", :as =&gt; 'new_entree'
  </code></pre>
  
  <p>That works, but the problem is when there's an error in the <code>create</code> action, I want to display the page again with the invalid input. But since there's no <code>new</code> action, I must do a <code>redirect_to new_entree_path</code>, which does not keep the user input.  </p>
  
  <p>I have tried the following (simplest) route:</p>
  
  <pre><code>resources :entrees
  </code></pre>
  
  <p>But then the path <code>http://localhost:3000/entrees/new/32</code> returns an error:  </p>
  
  <p><code>No route matches [GET] "/entrees/new/32"</code></p>
  
  <p>The question is, how can I declare the Entree resource in the routes file with a parameter for the <code>new</code> action ?</p>