Dear Ruby community,
I need some help (hopefully just a little) installing and using Ruby
on Rails. I'm fairly new to both Ruby and Rails, so I am following the
steps mentioned in the book "Agile Web Development with Rails" (by Dave
Thomas and David Heinemeier Hansson).
Currently, I am going through the steps of "Chapter 4: Instant
Gratification". I got to the point where I type "ruby script/server",
then connect to http://mylocalsite.local.net:3000/ and then see a nice
"Congratulations, you've put Ruby on Rails!" welcome message.
So far so good. In fact, On the WEBrick server side, I can see
these four lines when I try to visit that page (using a web browser):
192.168.1.222 - - [16/Nov/2005:15:38:11 MST] "GET / HTTP/1.1" 304 0
- -> /
192.168.1.222 - - [16/Nov/2005:15:38:11 MST] "GET /favicon.ico
HTTP/1.1" 304 0
- -> /favicon.ico
Okay, so now I run the command "ruby script/generate controller Say"
from the command line to create a controller called "say" (just like
the example in the book). It seems to work correctly -- that is, the
directory structure appears to be there as well as the
app/controllers/say_controller.rb file. I even edited the
SayController class to be:
class SayController < ApplicationController
def hello
end
end
Here's where things go wrong:
When I try to visit http://mylocalsite.local.net:3000/say/hello I
get a blank screen on my web browser. I get no error message or
anything. According to the book, I should see a "Template is missing"
error message, but instead I see nothing at all. (This even happens if
I stop and restart the WEBrick server.)
I even tried creating the file app/views/say/hello.rhtml (that all
it says is "Hello from Rails!") but when I reload the page, I still get
nothing. I should at least get an error message, right?
So now I'm not sure what to do. So far I've installed Rails two
times (to make sure I didn't miss a step) but I still get the same
error. In case anyone's interested, my version of Ruby is 1.8.2 and my
version of rubygems is 0.8.11 (running on Debian Linux).
I captured the output of the WEBrick server in case anyone wants to
see it. First a connection is make to
http://mylocalsite.local.net:3000/ is made (where everything looks
fine) and then a connection to
http://mylocalsite.local.net:3000/say/hello is made (where the entire
page is blank).
It looks like I'm missing a source file of some sort, but which one?
Did I not install gem correctly? Did I not use gem to install Rails
correctly? I'm not sure how to read the error output of the server to
figure out how to correct my problem.
Any help would be appreciated. I tried to give as much information
as I thought would help, but if some is missing, let me know and I'll
try to post it.
Thank you very much for any help. (Output of WEBrick server
follows.)
-- Jean-Luc
[2005-11-16 15:38:05] INFO WEBrick 1.3.1
[2005-11-16 15:38:05] INFO ruby 1.8.2 (2005-04-11) [i386-linux]
[2005-11-16 15:38:05] INFO WEBrick::HTTPServer#start: pid=1311
port=3000
192.168.1.222 - - [16/Nov/2005:15:38:11 MST] "GET / HTTP/1.1" 304 0
- -> /
192.168.1.222 - - [16/Nov/2005:15:38:11 MST] "GET /favicon.ico
HTTP/1.1" 304 0
- -> /favicon.ico
192.168.1.222 - - [16/Nov/2005:15:38:18 MST] "GET /say/hello HTTP/1.1"
200 0
- -> /say/hello
[2005-11-16 15:38:19] ERROR MissingSourceFile: no such file to load --
irb
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in
`require'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/breakpoint.rb:18
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:207:in
`load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:207:in
`load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:39:in
`require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:22:in
`depend_on'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:178:in
`require_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:178:in
`require_dependency'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:194:in
`const_missing'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:76:in
`reset_after_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/dispatcher.rb:46:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:117:in
`handle_dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:83:in
`service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:172:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:161:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:161:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/webrick_server.rb:69:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/servers/webrick.rb:59
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in
`require'
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/commands/server.rb:28
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:214:in
`require'
script/server:3
192.168.1.222 - - [16/Nov/2005:15:38:19 MST] "GET /favicon.ico
HTTP/1.1" 304 0
- -> /favicon.ico