SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot ChestRockwell's Avatar
    Join Date
    Nov 2003
    Location
    New Jersey
    Posts
    195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rails template not loading up

    Hello,
    I literally just started learing Ruby on Rails today so I am very new. To help I picked up the Agile Web Development book too and I have hit a little snag about 30 pages into it.

    I installed Ruby and Rails just like the book said. I then stopped apache2 (which is my default server)

    I created a new rails directory like so...
    Code:
        $> rails demo
    I then started the web server like so...
    Code:
       demo> script/server
    I tested it and it worked.

    I created a controller called Say
    Code:
         demo> script/generate controller Say
    that too worked.

    I then went inside the controller and defined a method called hello()

    Code:
      class SayController < ApplicationController
        def hello
        end
      end
    I then created an rhtml template that did nothing but print the words hello rails. I put that in the views directory. Now, at this point I should get my html page to pop up, but instead I get a blank page. Nothing. Looking at the source code and there is nothing there. Any ideas what I am doing wrong?

    Also, I stopped apache2 because I figured there may be some conflict having 2 webservers running at the same time. Should I stop it or is it OK to run apache and WEBrick at the same time?

    Thanks in advance.
    -- Joe C --
    "Do or do not. There is no try..."
    - Yoda

  2. #2
    SitePoint Addict
    Join Date
    Jan 2006
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can we see your view file?

  3. #3
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The rhtml file should be in views/say/hello.rhtml because it's in the say controller.

  4. #4
    SitePoint Zealot ChestRockwell's Avatar
    Join Date
    Nov 2003
    Location
    New Jersey
    Posts
    195
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the relplies guys,
    I actually figured out the problem. Everything was in the correct place, it was a problem with my install. I am running Ubuntu and it looks like gems didn't actually install all the packages that I needed. I ended up doing this:
    Code:
    > sudo apt-get install rails irb ri1.8 ruby1.8-dev
    and that got me all the stuff that was missing from the install. Not sure why the install didn't go correctly, but it is fine now.
    -- Joe C --
    "Do or do not. There is no try..."
    - Yoda


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •