Ruby on Rails Workarounds

I ran into some nasty bugs in RoR this weekend, so I thought I would share the fixes with you briefly, and perhaps get somebody to email me with a link to a fix to a separate nasty bug I have not been able to remedy...

This is what I was seeing on a new rails install inside of Webrick (mod_ruby/CGI/fastCGI failed to work at all):

Expected /var/www/vhosts/NAMEOFCLIENTGOESHERE/rubysite/controllers/home_controller.rb to define HomeController

No end of messing with the config would help, but I found some useful advice here: Slicehost Forum Post. Reinstall an old rails. LAME!

gem uninstall rails
gem install -v=1.1.6 rails

Admittedly, I had to rewrite some stuff with the refactorings on TurboGears, but at least I could figure it out. This rails thing was totally impenetrable.

Next, I ran against the wall trying to figure out how to get fastCGI working. FastCGI works on a new freshly created rails app, but fails utterly on this older one. IT is definitely something to do with the app specifically. Anybody seen this error before (and fixed it?):

Dispatcher failed to catch: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split (NoMethodError)
  /usr/lib/ruby/1.8/cgi.rb:897:in `parse'
  /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/cgi_ext/raw_post_data_fix.rb:45:in `initialize_query'
  /usr/lib/ruby/1.8/cgi.rb:2274:in `initialize'
  /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:606:in `new'
  /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:606:in `each_cgi'
  /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb:141:in `process_each_request!'
  /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb:55:in `process!'
  /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/fcgi_handler.rb:25:in `process!'
  ./dispatch.fcgi:24
killed by this error

Home Home