What? - 500 unless class Cart included


#1

I have been struggling with a problem for a while, and now have a
workaround, but I want to understand if something is borked in my
config or if this is a bug.

Setup: Mac OS X 10.4.3; Ruby 1.8.2; Rails 0.14.3

Problem: When I create a brand new project, I get an HTTP 500 status.
If I add a Cart model, the 500 goes away:

$ rails test
create
create app/controllers
[etc]
create log/test.log
$ cd test
$ script/server
=> Booting WEBrick…
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2005-11-22 23:47:55] INFO WEBrick 1.3.1
[2005-11-22 23:47:55] INFO ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
[2005-11-22 23:47:55] INFO WEBrick::HTTPServer#start: pid=27010
port=3000
127.0.0.1 - - [22/Nov/2005:23:48:05 GMT] “GET /something HTTP/1.1” 500 0

  • -> /something
    127.0.0.1 - - [22/Nov/2005:23:48:06 GMT] “GET /favicon.ico HTTP/1.1”
    200 0
  • -> /favicon.ico
    ^C[2005-11-22 23:48:11] INFO going to shutdown …
    [2005-11-22 23:48:11] INFO WEBrick::HTTPServer#start done.
    $ echo “class Cart;end”>app/models/Cart.rb
    $ script/server
    => Booting WEBrick…
    => Rails application started on http://0.0.0.0:3000
    => Ctrl-C to shutdown server; call with --help for options
    [2005-11-22 23:48:43] INFO WEBrick 1.3.1
    [2005-11-22 23:48:43] INFO ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
    [2005-11-22 23:48:43] INFO WEBrick::HTTPServer#start: pid=27012
    port=3000
    127.0.0.1 - - [22/Nov/2005:23:48:45 GMT] “GET /something HTTP/1.1”
    404 598
  • -> /something
    127.0.0.1 - - [22/Nov/2005:23:48:45 GMT] “GET /favicon.ico HTTP/1.1”
    200 0
  • -> /favicon.ico

[Obviously I am expecting 404, because I didn’t create a controller
or anything! - it’s the 500 I am concerned about]

Through experimentation I have found that the model must be Cart,
e.g. changing the file to Carter and the class to Carter, I get 500s
again [I have to restart Webrick].

I did a grep for cart in both my project directory and /usr/lib/ruby,
and nothing else seems to refer to any such class.

What’s happened!!!


#2

Found the answer in a response to someone else’s problem:

Clear all your sessions from /tmp

D’Oh!