Ruby on Rails tutorial FAILED on Windows ...

Discussion in 'Ruby' started by Sarah Tanembaum, Jan 12, 2005.

  1. 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
    Sarah Tanembaum, Jan 12, 2005
    #1
    1. Advertising

  2. 12/01/2005 08:17:30
    Sarah Tanembaum <> wrote in message
    <>

    > 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
    Graham Foster, Jan 12, 2005
    #2
    1. Advertising

  3. Sarah Tanembaum

    Carlos Guest

    Re: Help with Ruby on Rails tutorial on Windows ...

    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, Jan 12, 2005
    #3
  4. Re: Help with Ruby on Rails tutorial on Windows ...

    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!
    Sarah Tanembaum, Jan 12, 2005
    #4
  5. Graham Foster wrote:
    > 12/01/2005 08:17:30
    > Sarah Tanembaum <> wrote in message
    > <>
    >
    >>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, Jan 12, 2005
    #5
  6. Sarah Tanembaum

    Carlos Guest

    Re: Help with Ruby on Rails tutorial on Windows ...

    [Sarah Tanembaum <>, 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?
    Carlos, Jan 12, 2005
    #6
  7. Sarah Tanembaum

    Bill Atkins Guest

    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
    <> wrote:
    > Graham Foster wrote:
    > > 12/01/2005 08:17:30
    > > Sarah Tanembaum <> wrote in message
    > > <>
    > >
    > >>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"
    Bill Atkins, Jan 12, 2005
    #7
  8. Re: Help with Ruby on Rails tutorial on Windows ...

    Carlos wrote:
    > [Sarah Tanembaum <>, 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
    Sarah Tanembaum, Jan 12, 2005
    #8
  9. Re: Help with Ruby on Rails tutorial on Windows ...

    > 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
    Robert McGovern, Jan 12, 2005
    #9
  10. Sarah Tanembaum

    Bill Atkins Guest

    Re: Help with Ruby on Rails tutorial on Windows ...

    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
    <> 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"
    Bill Atkins, Jan 13, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    181
    Michael Campbell
    Mar 17, 2005
  2. Josef 'Jupp' SCHUGT
    Replies:
    5
    Views:
    174
    Stephan Kämper
    Jan 24, 2006
  3. Curt Hibbs
    Replies:
    0
    Views:
    99
    Curt Hibbs
    Feb 3, 2006
  4. anansi
    Replies:
    3
    Views:
    111
    barjunk
    Apr 29, 2007
  5. Jason Wong
    Replies:
    0
    Views:
    168
    Jason Wong
    Nov 20, 2007
Loading...

Share This Page