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:   PLEASE PLEASE FIX
Date:   2005-08-21 01:39:12
From:   gregg_tavares
This article is great and certainly makes me want to learn more except.... IT DOESN'T WORK. Hardly the best introduction to Rails and yet it's linked to directy on the front page of Rails.


I figured out (read "guessed") that in recipe/edit.rhtml the


<%= ' selected' if category.id == @recipe.category.id >>


needed to be


<%= ' selected' if category.id == @recipe.category_id %>>


period changed to underbar, Is that correct? Being a Rails newbie I need verification that the original is incorrect since as far as I know Rails could be doing some magic to get from recipe.category.id to recipe.catergory_id but something else is wrong. How is a newbie supposed to know?


Second, I also get the


ActiveRecord::RecordNotFound in Recipe#update
Couldn't find Recipe without an ID
Request
Parameters: {"recipe"=>{"title"=>"Ice Water", "id"=>"2", "category_id"=>"1", "description"=>"Everyone's favorite", "instructions"=>" Put ice cubes in a glass of wata\r\n "}}


error others have mentioned, what is the correct Rails like solution. 3 are offered below but none of them make any sense based on the supposed Rails philosophy of "Donít Repeat Yourself". Clearly the ID has been passed in as can be seen under Parameters in the error message. If it's there, why do I have to repeat myself and pass it in again?


Given this is practially THE OFFICIAL INTRODUCTION TO RAILS since it's linked on the front page of the Rails home page could someone ***PLEASE*** address this?


1 to 1 of 1
  1. PLEASE PLEASE FIX
    2005-08-21 01:47:48  gregg_tavares [View]

    • PLEASE PLEASE FIX
      2005-09-12 23:44:29  bjrubble [View]

1 to 1 of 1