ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Rolling with Ruby on Rails
Subject:   Couldn't find Recipe without an ID
Date:   2005-07-08 06:01:09
From:   Peter_Kehl_TBWA
When using Rails 0.13.0 (with ruby 1.8.2 (2004-12-25) ), after reference from Recipe to Category is added, submission of http://127.0.0.1:3000/recipe/edit/1 form doesn't work. It submits to http://127.0.0.1:3000/recipe/update, which shows an following error:


ActiveRecord::RecordNotFound in Recipe#update
Couldn't find Recipe without an ID
script/server:49
Show framework trace


Request


Parameters: {"recipe"=>{"title"=>"Happy Chips", "id"=>"1", "category_id"=>"2", "description"=>"Only for the brave!", "instructions"=>" Grab a few chips from your colleague. Ask first.\r\n "}}


A solution is to change the Edit Recipe edit.rhtml.


The line that was:


<input id="recipe_id" name="recipe[id]" size="30" type="hidden" value="<%= @recipe.id %>" />


should be:


<input id="id" name="id" type="hidden" value="<%= @recipe.id %>" />

1 to 1 of 1
  1. Couldn't find Recipe without an ID
    2005-08-16 01:07:29  SixSide [View]

    • Couldn't find Recipe without an ID
      2005-09-11 13:21:05  dankohn [View]

      • Couldn't find Recipe without an ID
        2005-09-13 06:12:04  Freewheelin [View]

      • Curt Hibbs photo Couldn't find Recipe without an ID
        2005-09-11 13:31:34  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

1 to 1 of 1