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:   Save yourself some frustration -- use this edit.rhtml
Date:   2005-09-14 06:55:49
From:   curth

Many thanks to everyone for their constructive feedback. I've made a few suggested changes to "edit.rhtml" (Figure 51) that should make the tutorial work more smoothly for everyone. I have submitted this to my editor to have the article updated. Unfortunately, my editor is on vacation until sometime next week and I'm sure that when he gets back he'll be swamped with catching up.


So, I'm posting the revised edit.rhtml here to help those of you who can't wait.



<html>
<head>
<title>Edit Recipe</title>
</head>
<body>
<h1>Edit Recipe</h1>


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

Title

<input id="recipe_title" name="recipe[title]" size="30"
type="text" value="<%= @recipe.title %>" />


Description

<input id="recipe_description" name="recipe[description]"
size="30" type="text"
value="<%= @recipe.description %>" />


Category:


<select name="recipe[category_id]">
<% @categories.each do |category| %>
<option value="<%= category.id %>"
<%= ' selected' if category.id == @recipe.category_id %>>
<%= category.name %>
</option>
<% end %>
</select>


Instructions

<textarea cols="40" id="recipe_instructions"
name="recipe[instructions]"
rows="20" wrap="virtual">
<%= @recipe.instructions %>
</textarea>


<input type="submit" value="Update" />
</form>



Show
(/recipe/show/<%= @recipe.id %>) |

Back
(/recipe/list)


</body>
</html>


1 to 1 of 1
  1. Curt Hibbs photo Save yourself some frustration -- use this edit.rhtml
    2005-09-14 07:01:35  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

1 to 1 of 1