hello world

I've done these steps before, but am retracing my steps. Now, it generates an error and I'm not sure why. Navigating to <http:// localhost:3000/hello> gives:

"Action Controller: Exception caught

Unknown action

No action responded to index"

Which is a bit frustrating because I've had it working in the past :frowning:

(the bash script prints out a copy of itself, if that's unclear)

[thufir@localhost ~]$ [thufir@localhost ~]$ [thufir@localhost ~]$ ./ruby.hello.txt

Wed Jun 20 08:59:17 BST 2007 /home/thufir thufir Fedora Core release 6 (Zod)      1 X=0      2 while [ $X -le 20 ]      3 do      4 echo ""      5 X=$((X+1))      6 done      7      8      9     10 date     11 pwd     12 whoami     13 cat /etc/fedora-release     14     15 cat /home/thufir/ruby.hello.txt -n     16     17     18 rails hello     19     20 ruby /home/thufir/hello/script/generate controller hello     21     22 # Create a file called index.rhtml in app/views/hello, containing "Hello world".     23 echo "hello world" > /home/thufir/hello/app/views/hello/ index.html     24     25 echo "http://localhost:3000/hello&quot;     26     27 ruby /home/thufir/hello/script/server       exists       exists app/controllers       exists app/helpers       exists app/models       exists app/views/layouts       exists config/environments       exists components       exists db       exists doc       exists lib       exists lib/tasks       exists log       exists public/images       exists public/javascripts       exists public/stylesheets       exists script/performance       exists script/process       exists test/fixtures       exists test/functional       exists test/integration       exists test/mocks/development       exists test/mocks/test       exists test/unit       exists vendor       exists vendor/plugins       exists tmp/sessions       exists tmp/sockets       exists tmp/cache       exists tmp/pids    identical Rakefile    identical README    identical app/controllers/application.rb    identical app/helpers/application_helper.rb    identical test/test_helper.rb    identical config/database.yml    identical config/routes.rb    identical public/.htaccess    identical config/boot.rb    identical config/environment.rb    identical config/environments/production.rb    identical config/environments/development.rb    identical config/environments/test.rb    identical script/about    identical script/breakpointer    identical script/console    identical script/destroy    identical script/generate    identical script/performance/benchmarker    identical script/performance/profiler    identical script/process/reaper    identical script/process/spawner    identical script/process/inspector    identical script/runner    identical script/server    identical script/plugin overwrite public/dispatch.rb? [Ynaqd] a forcing app        force public/dispatch.rb        force public/dispatch.cgi        force public/dispatch.fcgi    identical public/404.html    identical public/500.html    identical public/index.html    identical public/favicon.ico    identical public/robots.txt    identical public/images/rails.png    identical public/javascripts/prototype.js    identical public/javascripts/effects.js    identical public/javascripts/dragdrop.js    identical public/javascripts/controls.js    identical public/javascripts/application.js    identical doc/README_FOR_APP    identical log/server.log    identical log/production.log        force log/development.log    identical log/test.log       exists app/controllers/       exists app/helpers/       exists app/views/hello       exists test/functional/    identical app/controllers/hello_controller.rb    identical test/functional/hello_controller_test.rb    identical app/helpers/hello_helper.rb http://localhost:3000/hello => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2007-06-20 08:59:27] INFO WEBrick 1.3.1 [2007-06-20 08:59:27] INFO ruby 1.8.5 (2007-03-13) [i386-linux] [2007-06-20 08:59:27] INFO WEBrick::HTTPServer#start: pid=13610 port=3000 127.0.0.1 - - [20/Jun/2007:08:59:34 BST] "GET /hello HTTP/1.1" 404 570 - -> /hello [2007-06-20 08:59:40] INFO going to shutdown ... [2007-06-20 08:59:40] INFO WEBrick::HTTPServer#start done. [thufir@localhost ~]$

thanks,

Thufir

Hmm. When I did the following, and went to <http://localhost:3000/

I did see "hello world" as I wanted. However, I can't figure

out why it works when I type in the commands by hand but not from the bash script. I like the repeatability of the bash script, so want to fix it. I'm looking it over, but any input would be appreciated!

[thufir@localhost ~]$ [thufir@localhost ~]$ rails hello       exists       exists app/controllers       exists app/helpers       exists app/models       exists app/views/layouts       exists config/environments       exists components       exists db       exists doc       exists lib       exists lib/tasks       exists log       exists public/images       exists public/javascripts       exists public/stylesheets       exists script/performance       exists script/process       exists test/fixtures       exists test/functional       exists test/integration       exists test/mocks/development       exists test/mocks/test       exists test/unit       exists vendor       exists vendor/plugins       exists tmp/sessions       exists tmp/sockets       exists tmp/cache       exists tmp/pids    identical Rakefile    identical README    identical app/controllers/application.rb    identical app/helpers/application_helper.rb    identical test/test_helper.rb    identical config/database.yml    identical config/routes.rb    identical public/.htaccess    identical config/boot.rb    identical config/environment.rb    identical config/environments/production.rb    identical config/environments/development.rb    identical config/environments/test.rb    identical script/about    identical script/breakpointer    identical script/console    identical script/destroy    identical script/generate    identical script/performance/benchmarker    identical script/performance/profiler    identical script/process/reaper    identical script/process/spawner    identical script/process/inspector    identical script/runner    identical script/server    identical script/plugin overwrite public/dispatch.rb? [Ynaqd] a forcing app        force public/dispatch.rb        force public/dispatch.cgi        force public/dispatch.fcgi    identical public/404.html    identical public/500.html    identical public/index.html    identical public/favicon.ico    identical public/robots.txt    identical public/images/rails.png    identical public/javascripts/prototype.js    identical public/javascripts/effects.js    identical public/javascripts/dragdrop.js    identical public/javascripts/controls.js    identical public/javascripts/application.js    identical doc/README_FOR_APP    identical log/server.log    identical log/production.log        force log/development.log    identical log/test.log [thufir@localhost ~]$ [thufir@localhost ~]$ cd hello [thufir@localhost hello]$ [thufir@localhost hello]$ ruby script\generate controller hello ruby: No such file or directory -- scriptgenerate (LoadError) [thufir@localhost hello]$ ruby script/generate controller hello       exists app/controllers/       exists app/helpers/       exists app/views/hello       exists test/functional/    identical app/controllers/hello_controller.rb    identical test/functional/hello_controller_test.rb    identical app/helpers/hello_helper.rb [thufir@localhost hello]$ echo "hello world" > app/views/hello/ index.rhtml [thufir@localhost hello]$ [thufir@localhost hello]$ cat app/views/hello/index.rhtml hello world [thufir@localhost hello]$ [thufir@localhost hello]$ ruby script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2007-06-20 09:22:07] INFO WEBrick 1.3.1 [2007-06-20 09:22:07] INFO ruby 1.8.5 (2007-03-13) [i386-linux] [2007-06-20 09:22:07] INFO WEBrick::HTTPServer#start: pid=13738 port=3000 127.0.0.1 - - [20/Jun/2007:09:22:12 BST] "GET /hello HTTP/1.1" 200 12 http://mentalized.net/journal/2006/02/06/hello_ruby_on_rails_world/ -

/hello

[2007-06-20 09:22:32] INFO going to shutdown ... [2007-06-20 09:22:32] INFO WEBrick::HTTPServer#start done. [thufir@localhost hello]$ [thufir@localhost hello]$ [thufir@localhost hello]$ date Wed Jun 20 09:22:35 BST 2007 [thufir@localhost hello]$ [thufir@localhost hello]$

thanks,

Thufir

[...]

Oh, this is based on the tutorial at <The collected ramblings of Jakob Skjerning | mentalized.net 2006/02/06/hello_ruby_on_rails_world/>.

-Thufir

well, it worked!

[thufir@localhost ~]$ [thufir@localhost ~]$ [thufir@localhost ~]$ ./ruby.hello.txt

Wed Jun 20 09:47:14 BST 2007

current directory /home/thufir

whoami thufir

Fedora Core release 6 (Zod)      1 X=0      2 while [ $X -le 20 ]      3 do      4 echo ""      5 X=$((X+1))      6 done      7      8      9     10 date     11 echo ""     12 echo "current directory"     13 pwd     14 echo ""     15 echo "whoami"     16 whoami     17 echo ""     18 cat /etc/fedora-release     19     20 cat /home/thufir/ruby.hello.txt -n     21     22 X=0     23 while [ $X -le 10 ]     24 do     25 echo ""     26 X=$((X+1))     27 done     28     29     30 rails hello     31     32 ruby /home/thufir/hello/script/generate controller hello     33     34     35 echo "good grief charlie brown, it works" > /home/thufir/hello/ app/views/hello/index.rhtml     36     37     38     39 X=0     40 while [ $X -le 5 ]     41 do     42 echo ""     43 X=$((X+1))     44 done     45     46     47 echo "http://localhost:3000/hello&quot;     48 echo "http://localhost:3000/hello&quot;     49 echo "http://localhost:3000/hello&quot;     50     51     52     53 X=0     54 while [ $X -le 5 ]     55 do     56 echo ""     57 X=$((X+1))     58 done     59     60     61 ruby /home/thufir/hello/script/server

      exists       exists app/controllers       exists app/helpers       exists app/models       exists app/views/layouts       exists config/environments       exists components       exists db       exists doc       exists lib       exists lib/tasks       exists log       exists public/images       exists public/javascripts       exists public/stylesheets       exists script/performance       exists script/process       exists test/fixtures       exists test/functional       exists test/integration       exists test/mocks/development       exists test/mocks/test       exists test/unit       exists vendor       exists vendor/plugins       exists tmp/sessions       exists tmp/sockets       exists tmp/cache       exists tmp/pids    identical Rakefile    identical README    identical app/controllers/application.rb    identical app/helpers/application_helper.rb    identical test/test_helper.rb    identical config/database.yml    identical config/routes.rb    identical public/.htaccess    identical config/boot.rb    identical config/environment.rb    identical config/environments/production.rb    identical config/environments/development.rb    identical config/environments/test.rb    identical script/about    identical script/breakpointer    identical script/console    identical script/destroy    identical script/generate    identical script/performance/benchmarker    identical script/performance/profiler    identical script/process/reaper    identical script/process/spawner    identical script/process/inspector    identical script/runner    identical script/server    identical script/plugin overwrite public/dispatch.rb? [Ynaqd] a forcing app        force public/dispatch.rb        force public/dispatch.cgi        force public/dispatch.fcgi    identical public/404.html    identical public/500.html    identical public/index.html    identical public/favicon.ico    identical public/robots.txt    identical public/images/rails.png    identical public/javascripts/prototype.js    identical public/javascripts/effects.js    identical public/javascripts/dragdrop.js    identical public/javascripts/controls.js    identical public/javascripts/application.js    identical doc/README_FOR_APP    identical log/server.log    identical log/production.log        force log/development.log    identical log/test.log       exists app/controllers/       exists app/helpers/       exists app/views/hello       exists test/functional/    identical app/controllers/hello_controller.rb    identical test/functional/hello_controller_test.rb    identical app/helpers/hello_helper.rb

http://localhost:3000/hello http://localhost:3000/hello http://localhost:3000/hello

=> Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2007-06-20 09:47:29] INFO WEBrick 1.3.1 [2007-06-20 09:47:29] INFO ruby 1.8.5 (2007-03-13) [i386-linux] [2007-06-20 09:47:29] INFO WEBrick::HTTPServer#start: pid=14283 port=3000 127.0.0.1 - - [20/Jun/2007:09:47:37 BST] "GET /hello HTTP/1.1" 200 35 - -> /hello 127.0.0.1 - - [20/Jun/2007:09:47:42 BST] "GET /hello HTTP/1.1" 200 35 - -> /hello 127.0.0.1 - - [20/Jun/2007:09:47:44 BST] "GET /hello HTTP/1.1" 200 35 - -> /hello [2007-06-20 09:47:51] INFO going to shutdown ... [2007-06-20 09:47:51] INFO WEBrick::HTTPServer#start done. [thufir@localhost ~]$

Somewhere along the line, I think a .rhtml morphed to a .html, but other than that, I pretty much copied the first script to the second one and it worked....dunno why.

-Thufir

Dear Thufir,

In your first script you were echoing "hello world" to index.html.

It needs to be index.rhtml.

Additionally, your controller needs an index action in it.

But I can't figure out why you are doing this in _SUCH_ a hard way!

Try this (with SQLite3 installed as a prerequisite)

rails text -d sqlite3 cd text ./script/generate model HelloWorld title:string message:text rake db:migrate ./script/generate scaffold HelloWorld ./script/server

And then open your web browser and point to http://localhost:3001/hello_worlds/

Regards

Mikel

Dear Thufir,

In your first script you were echoing "hello world" to index.html.

It needs to be index.rhtml.

Boy, it took me about an hour to get it working. I probably looked at that line twenty times and my eye just went right over .html and said "fine". c'est la vie.

Additionally, your controller needs an index action in it.

english please :wink: what does that mean more concretely?

But I can't figure out why you are doing this in _SUCH_ a hard way!

I'm recovering ground with a script because I need it to be repeatable because I've run into a wall further down the line. This is a foundation.

Try this (with SQLite3 installed as a prerequisite)

[...]

The legacy database is MySQL, I have MySQL setup, I like the myPHPAdmin GUI, and, again, the legacy database is using MySQL.

The end goal is to get this working with <Google Code Archive - Long-term storage for Google Code Project Hosting. feed-on-feeds/

which is, ironically, a PHP application.

The next step is that I have a database "Dummy" with table "Dummy" which I would like listed. I did this before but forgot. Hence, the bash scripts.

Then, I'll move onto the legacy database, some day...

-Thufir

Get these books (PDF or paper)

Four Days on Rails and Agile Web Development with Rails

Read them, both books are pretty easy to follow, if you have worked with PHP, Rails shouldn't be that difficult. For me it was simply terminology. Once I learned how models and controllers worked, everything "just worked"

I have seen torrents on tpb and mininova, tho your mileage may vary. ~k