Hi Bill,
I am not able to get your email address other wise would have meial u
straight away. But anyway thanks for getting back to me.
I am practicing the RoR tutorial cookbook2
http://instantrails.rubyforge.org/tutorial/index.html ,i have created
the database cookbook2,created recipes,entered info in it and got to
listing recipe,then i followed these instruction from the tutorial
,these are the notes from the stage where i get stuck,
What Just Happened?
A single line of code, scaffold :recipe, brought everything to life. It
let us begin working with our data model. With virtually no work on our
part, it created the actions list, show, edit, and delete. It also
created default view templates for each of these actions.
Of course, these actions and views are very plain–not the sort of thing
you’d want users to see (unless they are total geeks). The good news is
that we can leave the scaffolding in place and slowly, one at a time,
provide our own versions of the actions and views. Each time you create
one of the actions or views it will override the scaffold’s version.
When you’re done, simply remove the scaffold statement from the
controller.
Before we do that, did you notice the URLs as you were playing around
with your new cookbook? Rails tries very hard to present the user with
pretty URLs. Rails URLs are simple and straightforward, not long and
cryptic.
Creating Actions and Views
The page that shows the list of all recipes (Figure 39 above)
desperately needs improvement. The way to do that is to take over the
handling of the list action from the scaffolding.
Edit recipe_controller.rb and add a list method similar to Figure 40.
Because we just created our own definition for the list action, Rails no
longer uses the scaffold version. Rails called our list method and then
tried to find a view template to render. Because we did not create one,
we received this “template missing” error. Let’s create our own view
template for the list action that only shows each recipe’s title and
date.
When we created our recipe controller, the generate controller script
also created a view directory where we can place the HTML templates that
the recipe controller can display. We need to create a template file
named list.rhtml. If you have worked with JSP or ASP pages, this will
look familiar. It is simply an html file with Ruby code embedded within
<% %> and <%= %> tags.,and i have entered all the code given there on
the web,getting the error…Missing
template.script/…/config/…/app/views/recipe/list.rhtml…