I’m three pages into the OnLamp RoR Tutorial  and am wrestling
with what appears to be a MySQL connection problem.
I’ve created a simple controller called “recipe” with a corresponding
“recipes” mysql table. The recipe controller is just a simple scaffold.
When I browse to “recipe/new”, though, I get these errors:
NoMethodError in RecipeController#new
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Probing further (and checking the archives of this list, esp. ), I
tried running script/console and querying MySQL directly. The results
ActiveRecord::Base.connection.execute(“SHOW FIELDS FROM recipe”)
ActiveRecord::StatementInvalid: Mysql::Error: Lost connection to
MySQL server during query: SHOW FIELDS FROM recipe
log' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/ active_record/connection_adapters/mysql_adapter.rb:185:inexecute’
I’ve reinstalled all of RoR using a validcode.at bash script –
this supposedly fixed all the standard Tiger-Ruby bugs and enabled
the ruby-mysql library, but I’m still having the same problem.
I’ve been googling for answers to this all night and am running out
of ideas. Can anyone who’s familiar with the particulars of this
setup give some advice?
Running: OSX10.4.4, Ruby 1.8.2, Rails 1.1.2, MySQL 4.1.16
Much thanks in advance for the help,