title: passing id parameter from show action to new action via link_to, rails
body: <p>I have some show action that displays one category. But from there I want via link to create new product. Point is that I passed category id and name via link_to.</p>
  
  <p>It goes well, it opens Product/new action. And in browsing bar there is link like this <code>http://mysite/products/new?id=43&amp;name=Skeleji</code> .its okay.</p>
  
  <p>But how can I make those id and name available in form, where I am filling information about new product? 
  After this when I click create, I want that theese values such category_id saves in db along with other information abaut product.</p>
  
  <p>Between, Product and Category I have built relationship.</p>
  
  <p>So far my code looks like this .</p>
  
  <p>My Category/show action code looks like this.</p>
  
  <pre><code>&lt;%= link_to "Add Product", {:controller =&gt; "products", :action =&gt; "new", :id =&gt; @category.id, :name =&gt; @category.name }%&gt;
  </code></pre>
  
  <p>Product controller, new action looks like this.</p>
  
  <pre><code>def new
  @product = Product.new
  @product.category_id = @category.id
  end
  </code></pre>
  
  <p>Clicking create it creates project, but without category_id. Where could be the problem ?
  Maybe the code what is under new action,actually should be under create action. About year ago I managed to do such thing, but I can't find that project.:(</p>