# Ruby on Rails tutorial FAILED on Windows

**URL:** <https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754>\
**Category:** ruby-talk\
**Created:** [12 January 2005 07:56 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754 "2005-01-12T07:56:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarah\_Tanembaum1](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Sarah\_Tanembaum1](https://rubytalk.org/u/Sarah_Tanembaum1)\
**Post date:** [12 January 2005 07:56 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/1 "2005-01-12T07:56:17Z")

</div>

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](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\>  
&nbsp;&nbsp;&nbsp;\<head\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<title\>My todo list\</title\>  
&nbsp;&nbsp;&nbsp;\</head\>

&nbsp;&nbsp;&nbsp;\<body\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<% @items.each do |@item| %\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%= @item.description %\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<br /\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<% end %\>  
&nbsp;&nbsp;&nbsp;\</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  
&nbsp;&nbsp;&nbsp;&nbsp;instead of Unix forward slash(/)?  
3) So, I did a little experiment, I try to execute the list.rhtml using  
&nbsp;&nbsp;&nbsp;&nbsp;erb from console, "erb app\views\todo\list.rhtml".  
&nbsp;&nbsp;&nbsp;&nbsp;It gives me the following error,

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

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

&nbsp;&nbsp;&nbsp;&nbsp;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"

> **···**
>
> ----------------------
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;So, is it something todo with erb or eruby? As far as I can  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;remember, the .rhtml file is eruby file.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How do I correct this problem, otherwise I can even continue to  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;explore Ruby On Rails, because I can't even pass the simplest  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tutorial.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hellllp!
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Thanks

---

<div class="post-metadata">

**Author:** ![Graham\_Foster](https://avatars.discourse-cdn.com/v4/letter/g/e47c2d/32.png) [@Graham\_Foster](https://rubytalk.org/u/Graham_Foster)\
**Post date:** [12 January 2005 08:31 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/2 "2005-01-12T08:31:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Carlos](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@Carlos](https://rubytalk.org/u/Carlos)\
**Post date:** [12 January 2005 08:45 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/3 "2005-01-12T08:45:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sarah\_Tanembaum1](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Sarah\_Tanembaum1](https://rubytalk.org/u/Sarah_Tanembaum1)\
**Post date:** [12 January 2005 16:46 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/4 "2005-01-12T16:46:22Z")

</div>

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  
&nbsp;&nbsp;&nbsp;@items = Todo.find\_all  
end

And, nothing is shown.

HELP!

---

<div class="post-metadata">

**Author:** ![Sarah\_Tanembaum1](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Sarah\_Tanembaum1](https://rubytalk.org/u/Sarah_Tanembaum1)\
**Post date:** [12 January 2005 16:51 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/5 "2005-01-12T16:51:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Carlos](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@Carlos](https://rubytalk.org/u/Carlos)\
**Post date:** [12 January 2005 17:14 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/6 "2005-01-12T17:14:58Z")

</div>

[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  
> &nbsp;&nbsp;@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](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](http://localhost:3000/todo/new) to add one?

---

<div class="post-metadata">

**Author:** ![Bill\_Atkins](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bill\_Atkins](https://rubytalk.org/u/Bill_Atkins)\
**Post date:** [12 January 2005 17:15 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/7 "2005-01-12T17:15:01Z")

</div>

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|  
> &nbsp;&nbsp;('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr  
> end; print "\n"

---

<div class="post-metadata">

**Author:** ![Sarah\_Tanembaum1](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@Sarah\_Tanembaum1](https://rubytalk.org/u/Sarah_Tanembaum1)\
**Post date:** [12 January 2005 21:36 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/8 "2005-01-12T21:36:17Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![Robert\_McGovern1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Robert\_McGovern1](https://rubytalk.org/u/Robert_McGovern1)\
**Post date:** [12 January 2005 23:31 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/9 "2005-01-12T23:31:05Z")

</div>

> 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](http://wiki.rubyonrails.com/rails/show/ProductionEnvironments)

Rob

---

<div class="post-metadata">

**Author:** ![Bill\_Atkins](https://avatars.discourse-cdn.com/v4/letter/b/c4cdca/32.png) [@Bill\_Atkins](https://rubytalk.org/u/Bill_Atkins)\
**Post date:** [13 January 2005 04:05 UTC](https://rubytalk.org/t/ruby-on-rails-tutorial-failed-on-windows/15754/10 "2005-01-13T04:05:30Z")

</div>

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](http://wiki.rubyonrails.com/rails/show/ProductionEnvironments)
> > 
> > Rob
> 
> --  
> $stdout.sync = true  
> "Just another Ruby hacker.".each\_byte do |b|  
> &nbsp;&nbsp;('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr  
> end; print "\n"
