Ruby on Rails tutorial FAILED on Windows

I follow the Ruby on Rail documentation, it works up to list method.
All other example prior to this works!

Under "Displaying the items: part I", I added the following line in the
app\controllers\todo_controller.rb

def list
end

And when I reload my browser, or point my browser to http://localhost:3000/todo/list, it gives me “template missing” page.

So far so good, as expected.

Next, I follow the tutorial to create a blank file in create a blank file in app\views\todo\ called list.rhtml. As instructed, I reloaded my browser and sure it is I got a blank page as expected.

Next, I copied the following into the list.rhtml file,
<html>
   <head>
     <title>My todo list</title>
   </head>

   <body>
     <% @items.each do |@item| %>
     <%= @item.description %>
     <br />
     <% end %>
   </body>
</html>

I save it, and reload my browser. Instead of getting the exptected result, that is "Do my bed", I got a blank page as well.

1) Has this tutorial been tested on Windows environment?
2) Is it because that windows use blackslash(\) for directory separator
    instead of Unix forward slash(/)?
3) So, I did a little experiment, I try to execute the list.rhtml using
    erb from console, "erb app\views\todo\list.rhtml".
    It gives me the following error,

    (erb):7: undefined method `each' for nil:NilClass (NoMethodError)

    but then, I remember I have eruby for mswin version 1.04, so just to
    check it out, I tried with it as well,
    "eruby app\views\todo\list.rhtml"

    It still give me the same error as above, plus other things:

7: undefined method `each' for nil:NilClass (NoMethodError)
--- generated code ---
print "<html>\n"
print " <head>\n"
print " <title>My todo list</title>\n"
print " </head>\n"
print "\n"
print " <body>\n"
print " "; @items.each do |@item| ; print "\n"
print " "; print(( @item.description )); print "\n"
print " <br />\n"
print " "; end ; print "\n"
print " </body>\n"
print "</html>\n"

···

----------------------

     So, is it something todo with erb or eruby? As far as I can
     remember, the .rhtml file is eruby file.

     How do I correct this problem, otherwise I can even continue to
     explore Ruby On Rails, because I can't even pass the simplest
     tutorial.

     Hellllp!

     Thanks

12/01/2005 08:17:30
Sarah Tanembaum <sarahtanembaum@yahoo.com> wrote in message
<34k3ghF4adbm8U1@individual.net>

I follow the Ruby on Rail documentation, it works up to list method.

All other example prior to this works!

....

I save it, and reload my browser. Instead of getting the exptected
result, that is "Do my bed", I got a blank page as well.

That was an example created using the New Todo option. Now the
tutorial wasn't clear about inserting a record, and it doesn't work
anyway. The reason that he don't get a display is that there are no
records. If you insert a record using another product (say WinSQL) it
should work.
When you move onto the "scaffold" bit (a few paragraphs down) - you
will probably get to the bit where it all fell over for me too. I
ended up build the scaffold and editing the created files, because
the example failed to work for me too.
Graham

Sarah Tanembaum wrote:

[...]

Next, I copied the following into the list.rhtml file,

[...]

The tutorial shows another step here. Did you miss it?

···

I save it, and reload my browser. Instead of getting the exptected result, that is "Do my bed", I got a blank page as well.

Carlos wrote:

Sarah Tanembaum wrote:

[...]

Next, I copied the following into the list.rhtml file,

[...]

The tutorial shows another step here. Did you miss it?

I save it, and reload my browser. Instead of getting the exptected result, that is "Do my bed", I got a blank page as well.

You are right, there is another step prior to the last reload, which I did that as well(I did not forgot it in following the tutorial, just forgot to mention it in my question, sorry).
I DID change the list method in app\controllers\todo_controller.rb to the following:

def list
   @items = Todo.find_all
end

And, nothing is shown.

HELP!

Graham Foster wrote:

12/01/2005 08:17:30
Sarah Tanembaum <sarahtanembaum@yahoo.com> wrote in message
<34k3ghF4adbm8U1@individual.net>

I follow the Ruby on Rail documentation, it works up to list method.

All other example prior to this works!

...

I save it, and reload my browser. Instead of getting the exptected result, that is "Do my bed", I got a blank page as well.

That was an example created using the New Todo option. Now the tutorial wasn't clear about inserting a record, and it doesn't work anyway. The reason that he don't get a display is that there are no records. If you insert a record using another product (say WinSQL) it should work.
When you move onto the "scaffold" bit (a few paragraphs down) - you will probably get to the bit where it all fell over for me too. I ended up build the scaffold and editing the created files, because the example failed to work for me too.
Graham

How one suppose to learn if even the tutorial failed to show how it works. Is it depend on particular implementation? Is it because I'm running it on Windows?

If the author of this Tutorial did it, why it works for him but not for me or you as well?

Thanks

[Sarah Tanembaum <sarahtanembaum@yahoo.com>, 2005-01-12 17.46 CET]

I DID change the list method in app\controllers\todo_controller.rb to
the following:

def list
  @items = Todo.find_all
end

And, nothing is shown.

The tutorial says that at this point,

"If you added any items while you played with scaffolding, you should see
them displayed, if you didn’t, go to http://localhost:3000/todo/new and add
an item."

Did you add an item when you played with scaffolding?

If not, did you go to http://localhost:3000/todo/new to add one?

It does work on Windows. The folks in the Rails mailing list
responded to this (cross-posted) message and explained that you have
to give @items a value in your controller's #list method if you expect
list.rhtml to work. This _is_ mentioned in the tutorial, right below
the source for list.rhtml.

Bill

···

On Thu, 13 Jan 2005 01:51:16 +0900, Sarah Tanembaum <sarahtanembaum@yahoo.com> wrote:

Graham Foster wrote:
> 12/01/2005 08:17:30
> Sarah Tanembaum <sarahtanembaum@yahoo.com> wrote in message
> <34k3ghF4adbm8U1@individual.net>
>
>>I follow the Ruby on Rail documentation, it works up to list method.
>
>
>>All other example prior to this works!
>
> ...
>
>>I save it, and reload my browser. Instead of getting the exptected
>>result, that is "Do my bed", I got a blank page as well.
>>
>
> That was an example created using the New Todo option. Now the
> tutorial wasn't clear about inserting a record, and it doesn't work
> anyway. The reason that he don't get a display is that there are no
> records. If you insert a record using another product (say WinSQL) it
> should work.
> When you move onto the "scaffold" bit (a few paragraphs down) - you
> will probably get to the bit where it all fell over for me too. I
> ended up build the scaffold and editing the created files, because
> the example failed to work for me too.
> Graham
How one suppose to learn if even the tutorial failed to show how it
works. Is it depend on particular implementation? Is it because I'm
running it on Windows?

If the author of this Tutorial did it, why it works for him but not for
me or you as well?

Thanks

--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
  ('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"

Carlos wrote:

[Sarah Tanembaum <sarahtanembaum@yahoo.com>, 2005-01-12 17.46 CET]

I DID change the list method in app\controllers\todo_controller.rb to the following:

def list
@items = Todo.find_all
end

And, nothing is shown.

The tutorial says that at this point,

"If you added any items while you played with scaffolding, you should see
them displayed, if you didn’t, go to http://localhost:3000/todo/new and add
an item."

Did you add an item when you played with scaffolding?

If not, did you go to http://localhost:3000/todo/new to add one?

Thanks Carlos, that was it! And finally, I finished up this exellent tutorial. Thanks again.

But one I notice, how come it is so slow everytime I refresh the browser just to execute this simple apps? I can't imagine if ran against a full fledge application that has thousands lines of code.

Vive Ruby and Ruby on Rails!

Sarah

But one I notice, how come it is so slow everytime I refresh the browser
just to execute this simple apps? I can't imagine if ran against a full
fledge application that has thousands lines of code.

Sarah check out http://wiki.rubyonrails.com/rails/show/ProductionEnvironments

Rob

Does that apply to WEBrick as well? Should I expect faster refresh
rates after switching to Apache+FastCGI, even if the application is
serving only one user?

Bill

···

On Thu, 13 Jan 2005 08:31:05 +0900, Robert McGovern <robert.mcgovern@gmail.com> wrote:

> But one I notice, how come it is so slow everytime I refresh the browser
> just to execute this simple apps? I can't imagine if ran against a full
> fledge application that has thousands lines of code.

Sarah check out http://wiki.rubyonrails.com/rails/show/ProductionEnvironments

Rob

--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
  ('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"