Action Controller: Exception caught

I’m getting:

Routing Error

no route found to match “/expenses/” with {:method=>:get}

When pointing the browser to http://localhost:3000/expenses/ as per
the
tutorial at http://developer.apple.com/tools/rubyonrails.html. (No,
I’m not a Mac user.)

Is this due to something I’m doing (code wise) or a configuration of
rails or ruby? Google indicates that it may be due to rails
configuration, but it seems more likely that I’ve made an error given
that I’m learning.

At first I thought there was a problem with the database configuration,
but that seems fine.

My results:

thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ rake db:migrate VERSION=0 --trace
(in /home/thufir/rubyCode/expenses)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Accounts: reverting

– drop_table(:accounts)
→ 0.0701s
== Accounts: reverted (0.0707s)

** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
thufir@arrakis ~/rubyCode/expenses $ mysql --user=root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 66
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use expenses_development;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
±-------------------------------+
| Tables_in_expenses_development |
±-------------------------------+
| schema_info |
±-------------------------------+
1 row in set (0.00 sec)

mysql> quit
Bye
thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ rake db:migrate --trace
(in /home/thufir/rubyCode/expenses)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Accounts: migrating

– create_table(:accounts)
→ 0.0166s
== Accounts: migrated (0.0172s)

** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ mysql --user=root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 68
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> use expenses_development;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
±-------------------------------+
| Tables_in_expenses_development |
±-------------------------------+
| accounts |
| schema_info |
±-------------------------------+
2 rows in set (0.00 sec)

mysql> quit
Bye
thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ cat config/database.yml

development:
adapter: mysql
database: expenses_development
username: root
password:
host: localhost
socket: /var/run/mysqld/mysqld.sock
test:
adapter: mysql
database: expenses_test
username: root
password:
host: localhost
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql
database: expenses_production
username: root
password:
host: localhost
socket: /var/run/mysqld/mysqld.sock

thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ cat db/migrate/001_accounts.rb

class Accounts < ActiveRecord::Migration

    def self.up
            create_table :accounts do |table|
                    table.column :name, :string
                    table.column :budget, :float
            end
    end

    def self.down
            drop_table :accounts
    end

end

thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ 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-11-25 02:06:58] INFO WEBrick 1.3.1
[2007-11-25 02:06:58] INFO ruby 1.8.6 (2007-09-24) [i686-linux]
[2007-11-25 02:06:58] INFO WEBrick::HTTPServer#start: pid=20804
port=3000
127.0.0.1 - - [25/Nov/2007:02:07:05 PST] “GET /expenses/ HTTP/1.1” 404
623

  • → /expenses/
    127.0.0.1 - - [25/Nov/2007:02:07:35 PST] “GET / HTTP/1.1” 200 7552
  • → /
    127.0.0.1 - - [25/Nov/2007:02:07:36 PST] “GET /javascripts/prototype.js
    HTTP/1.1” 200 71260
    http://localhost:3000/ → /javascripts/prototype.js
    127.0.0.1 - - [25/Nov/2007:02:07:36 PST] “GET /javascripts/effects.js
    HTTP/1.1” 200 38200
    http://localhost:3000/ → /javascripts/effects.js
    127.0.0.1 - - [25/Nov/2007:02:07:36 PST] “GET /images/rails.png
    HTTP/1.1”
    200 1787
    http://localhost:3000/ → /images/rails.png
    [2007-11-25 02:07:55] INFO going to shutdown …
    [2007-11-25 02:07:55] INFO WEBrick::HTTPServer#start done.
    thufir@arrakis ~/rubyCode/expenses $
    thufir@arrakis ~/rubyCode/expenses $
    thufir@arrakis ~/rubyCode/expenses $ cat /etc/gentoo-release
    Gentoo Base System release 1.12.9
    thufir@arrakis ~/rubyCode/expenses $
    thufir@arrakis ~/rubyCode/expenses $ date
    Sun Nov 25 02:18:43 PST 2007
    thufir@arrakis ~/rubyCode/expenses $

thanks,

Thufir

You need to just go to http://localhost:3000. The name of your
application is expenses, that does not mean you need to add /expenses to
the end of your URL. Remove expenses and you should see the rails start
page. Delete index.html from your public folder and you should be good
to go. Then you should be able to continue with your tutorial.

On Mon, 26 Nov 2007 05:21:28 +0100, Ben J. wrote:

You need to just go to http://localhost:3000. The name of your
application is expenses, that does not mean you need to add /expenses to
the end of your URL. Remove expenses and you should see the rails start
page. Delete index.html from your public folder and you should be good
to go. Then you should be able to continue with your tutorial.

After deleting expenses/public/index.html and going to <http://
localhost:3000/> I get:

Routing Error

no route found to match “/” with {:method=>:get}

Is the tutorial in error? It says:

$ script/server

Then point your web browser at http://localhost:3000/expenses. You
should
see the web page that lets you create new accounts.

http://developer.apple.com/tools/rubyonrails.html

Looking for a different tutorial :slight_smile:

-Thufir