|
|
RubyOnRailsFrom $1Table of contents
On Win32 - with apache2 in c:\usr\local\apache
Base Install and Test
h5. The Cookbook Demo Program
scaffold:recipe def list @recipes = Recipe.find_all end def edit @recipe = Recipe.find(@params(["id"]) @categories = Category.find_all end
<html> <head> <title>All Recipes</title> </head> <body> <h1>Online Cookbook - All Recipes</h1> <table border="1"> <tr> <td width="80%"><p align="center"><i><b>Recipe</b></i></td> <td width="20%"><p align="center"><i><b>Date</b></i></td> </tr> <% @recipes.each do |recipe| %> <tr> <td><%= link_to recipe.title, :action => "show", :id => recipe.id %></td> <td><%= recipe.date %></td> </tr> <% end %> </table> <p><%= link_to "Create new recipe", :action => "new" %></p> </body> </html>
scaffold:category
belongs_to:category
has_many:recipies
Tags:
none |