Hi - this is my first day with Ruby on Rails. I''m starting out by working through the Helloworld (Hello Ruby) example program printed up in "Agile Web Development with Rails." My steps are as in the text: 1. ruby script/generate controller Say 2. edit the proper file and add the hello method 3. fire up the browser using address http://localhost:3000 4. fire up the browser again using the address http://localhost:3000/say/hello/ steps 1 and 2 are easy step 3 produces a nice "Rails: Welcome Aboard" page Getting started Here''s how to get rolling: 1. Create your databases and edit config/database.yml Rails needs to know your login and password. 2. Use script/generate to create your models and controllers To see all available options, run it without parameters. 3. Set up a default route and remove or rename this file Routes are setup in config/routes.rb. step 4 produces nothing I''m at a loss. I thought that I did what was needed. Yet the web browser screen comes back empty. Note that I didn''t setup a database nor setup a default route. If that is perhaps the issue then that''s where I''ll need to start. Sincerely, Barney Toma _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Dec 22, 2005, at 12:36 PM, Barney Toma wrote:> 1. ruby script/generate controller Say > 2. edit the proper file and add the hello methodWhat''s in the hello method? If there''s very little (nothing?), you''ll need to add a view as well. -- -- Tom Mornini
On 12/22/05, Barney Toma <barney.toma-cmaem7PIVQTQAyQhgwMYSA@public.gmane.org> wrote:> Hi - this is my first day with Ruby on Rails. > I''m starting out by working through the Helloworld (Hello Ruby) example > program printed up in "Agile Web Development with Rails." > > My steps are as in the text: > > 1. ruby script/generate controller Say > 2. edit the proper file and add the hello method > 3. fire up the browser using address http://localhost:3000 > 4. fire up the browser again using the address > http://localhost:3000/say/hello/ > > steps 1 and 2 are easy > step 3 produces a nice "Rails: Welcome Aboard" page > > > Getting started > Here''s how to get rolling: > > Create your databases and edit config/database.yml > > Rails needs to know your login and password. > > Use script/generate to create your models and controllers > > To see all available options, run it without parameters. > > Set up a default route and remove or rename this file > > Routes are setup in config/routes.rb. > > step 4 produces nothing > > I''m at a loss. I thought that I did what was needed. > Yet the web browser screen comes back empty. > > Note that I didn''t setup a database nor setup a default route. > If that is perhaps the issue then that''s where I''ll need to start. > > Sincerely, > Barney TomaI assume your expecting the "Template is missing" error as shown on pg. 32? Do you have a file "./app/views/say/hello.rhtml". For the error to occur, this file has to be missing. If the file exists, but is empty you will get a blank page. When you put in the code at the top of pg 33, you should get your first static page. FYI: I''m only about 20 pages ahead of you, but I didn''t have any issues with the above. HTH Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century
> > just be sure u have a say_controller.rb in app/controllers with a class > SayController < ApplicationController > and u have de def hello in that file with render_text are a .rhtml file > behind.I have each of those pieces in place.> try to create the rail app with rails myfoolishapp > then just save your say_controller.rb in ! > >I have my previously saved say_controller in app/controllers. It looks like the one on page 31 with the .rhtml file on p33 behind. Now that those preliminary setup steps are completed, comes the time to see what the system will reply based on my setup. I type rails script/controller (to run WEBrick) mozilla http://localhost:3000/say/hello/ I expect "Hello from Rails" (as on p 33) I actually see (a blank page). Typing mozilla http://localhost:3000/say/myfoolishapp/ produces (also a blank page). _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> > > > just be sure u have a say_controller.rb in app/controllers with a class > SayController < ApplicationController > and u have de def hello in that file with render_text are a .rhtml file > behind.I have setup exactly those pieces (controller and view). cat app/controllers/say_controller.rb class SayController < ApplicationController def hello end end b@yx:~/src/work/demo$ cat app/views/say/hello.rhtml <html> <head> <title>Hello, Rails!</title> </head> <body> <h1>Hello from Rails!</h1> </body> </html> however, my program doesn''t produce the expected output--it doesn''t produce any output. After starting WEBrick, mozilla http://localhost:3000/ works fines (it produces a default greeting). But mozilla http://localhost:3000/say/hello/ doesn''t (it produces a blank page). If you have any suggestions or tests that I can run--let me know. Thanks in advance, Barney Toma. _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 12/23/05, Barney Toma <barney.toma-cmaem7PIVQTQAyQhgwMYSA@public.gmane.org> wrote:> > > > > > > just be sure u have a say_controller.rb in app/controllers with a class > SayController < ApplicationController > > and u have de def hello in that file with render_text are a .rhtml file > behind. > > I have setup exactly those pieces (controller and view). > cat app/controllers/say_controller.rb > class SayController < ApplicationController > > def hello > end > end > > b@yx:~/src/work/demo$ cat app/views/say/hello.rhtml > <html> > <head> > <title>Hello, Rails!</title> > </head> > <body> > <h1>Hello from Rails!</h1> > </body> > </html> > > > > however, my program doesn''t produce the expected output--it doesn''t > produce any output. > After starting WEBrick, mozilla http://localhost:3000/ works fines (it > produces a default greeting). > But mozilla http://localhost:3000/say/hello/ doesn''t (it > produces a blank page). If you have any suggestions or tests that I can > run--let me know. > Thanks in advance, Barney Toma.Did you start WEBrick from your top folder? (ie. the folder that contains app, script, public, etc.) Greg -- Greg Freemyer The Norcross Group Forensics for the 21st Century
Please note that the rails literature gets updated frequently. The documentation and latest source versions often contain fixes to recent issues. The issue here was that the documentation suggested using an older version of ruby. And it just so happened that the newest stable version of ruby was the version that was really needed. Good luck! On 12/23/05, Barney Toma <barney.toma@alumni.usc.edu> wrote:> > > > > > > > just be sure u have a say_controller.rb in app/controllers with a class > > SayController < ApplicationController > > and u have de def hello in that file with render_text are a .rhtml file > > behind. > > > I have setup exactly those pieces (controller and view). > > cat app/controllers/say_controller.rb > class SayController < ApplicationController > > def hello > end > end > > b@yx:~/src/work/demo$ cat app/views/say/hello.rhtml > <html> > <head> > <title>Hello, Rails!</title> > </head> > <body> > <h1>Hello from Rails!</h1> > </body> > </html> > > > > however, my program doesn''t produce the expected output--it doesn''t > produce any output. > After starting WEBrick, mozilla http://localhost:3000/ works fines (it > produces a default greeting). > But mozilla http://localhost:3000/say/hello/ doesn''t (it produces a blank > page). If you have any suggestions or tests that I can run--let me > know. > Thanks in advance, Barney Toma. > >
Please note that the rails literature gets updated frequently. The documentation and latest source versions often contain fixes to recent issues. The issue here was that the documentation suggested using an older version of ruby. And it just so happened that the newest stable version of ruby was the version that was really needed. Good luck!
On Dec 31, 2005, at 8:46 AM, Barney Toma wrote:> On 12/23/05, Barney Toma <barney.toma@alumni.usc.edu> wrote: >> I have setup exactly those pieces (controller and view). >> >> cat app/controllers/say_controller.rb >> class SayController < ApplicationController >> >> def hello >> end >> end >> >> b@yx:~/src/work/demo$ cat app/views/say/hello.rhtml >> <html> >> <head> >> <title>Hello, Rails!</title> >> </head> >> <body> >> <h1>Hello from Rails!</h1> >> </body> >> </html> >> >> >> >> however, my program doesn''t produce the expected output--it >> doesn''t >> produce any output. >> After starting WEBrick, mozilla http://localhost:3000/ works fines >> (it >> produces a default greeting). >> But mozilla http://localhost:3000/say/hello/ doesn''t (it produces >> a blank >> page). If you have any suggestions or tests that I can run-- >> let me >> know.I''ve noticed that with Mozilla browsers, they will sometimes show a blank page when Webrick serves up an error 500. I noticed this happen usually when Rails is having difficulties connecting to a database, or config/database.yaml is configured incorrectly. Looking at log/ development.log will give you a clue usually. If you are not using a database for your application, you may want to remove the Database configuration or comment it out, under the development section. Or if you will be using one, set up an appropriate beginning database and set the configurations in there correctly. Hope that is of some help. sean
On Dec 31, 2005, at 8:46 AM, Barney Toma wrote:> On 12/23/05, Barney Toma <barney.toma@alumni.usc.edu> wrote:- Hide quoted text ->> I have setup exactly those pieces (controller and view). >> >> cat app/controllers/say_controller.rb >> class SayController < ApplicationController >> >> def hello >> end >> end >> >> b@yx:~/src/work/demo$ cat app/views/say/hello.rhtml >> <html> >> <head> >> <title>Hello, Rails!</title> >> </head> >> <body> >> <h1>Hello from Rails!</h1> >> </body> >> </html> >> >> >> >> however, my program doesn''t produce the expected output--it >> doesn''t >> produce any output. >> After starting WEBrick, mozilla http://localhost:3000/ works fines >> (it >> produces a default greeting). >> But mozilla http://localhost:3000/say/hello/ doesn''t (it produces >> a blank >> page). If you have any suggestions or tests that I can run-- >> let me >> know.I''ve noticed that with Mozilla browsers, they will sometimes show a blank page when Webrick serves up an error 500. I noticed this happen usually when Rails is having difficulties connecting to a database, or config/database.yaml is configured incorrectly. Looking at log/ development.log will give you a clue usually. If you are not using a database for your application, you may want to remove the Database configuration or comment it out, under the development section. Or if you will be using one, set up an appropriate beginning database and set the configurations in there correctly. Also you can try starting up WEBRick in debug mode using the following commnand ruby -d script/server After the debugger launches WEBRick, you can then request a page, and see what is possibly causing the error. You''ll probably see a lot of errors that are pretty normal, but scan through it and you might recognize something that is yours. Hope that is of some help. -- Sean Wolfe master nerd of i heart squares, Co. 3711 N. Ravenswood Ave. #147 Chicago, IL 60613 Ph. (773) 531-6301 Fx. (773) 529-7041 http://www.iheartsquares.com