Help with error "undefined method `downcase' for nil:NilClass" after migration

Hi all,
I have a rails 1.5.2 application. I’ve frozen the application via the “rake rails:freeze:gems” command. This application worked well on a server I previously had it installed on. My server was getting really slow, and I requested that I be moved to a new server. When I perform a “gem list rails” command on my new host, I receive only version 1.2.6. Since I froze my app with 1.2.5, will it need other gems that won’t be installed on the server since it only has version 1.2.6? Its deployed on a shared host at bluehost, which uses apache 1.3.39 and fcgi. If I run the dispatch.rb, or dispatch.fcgi from the command line I get the same error. I’m a bit of a RoR deployment noob, so your help is greatly appreciated.

Thanks,
Todd

If you've frozen gems then the version of rails installed on your server should make no difference. Where is this error occurring?

Fred

This occurs when I try to load any page. Even running the dispatch scripts from the command line cause the issue, so I think its definitely in my setup.

This occurs when I try to load any page. Even running the dispatch
scripts from the command line cause the issue, so I think its
definitely in my setup.

If it happens all the time, then at least provide a backtrace &
example of it happening once

Fred

Here’s a stacktrace from production.log

Logfile created on Sun Dec 23 07:37:56 -0700 2007 by /

undefined method downcase' for nil:NilClass /home/ninecons/rails/inventory/vendor/rails/actionpack/lib/action_controller/request.rb:22:in method’

/home/ninecons/rails/inventory/vendor/rails/actionpack/lib/action_controller/routing.rb:1366:in extract_request_environment' /home/ninecons/rails/inventory/vendor/rails/actionpack/lib/action_controller/routing.rb:1315:in recognize’

/home/ninecons/rails/inventory/vendor/rails/railties/lib/dispatcher.rb:40:in `dispatch’
./dispatch.rb:10

Here's a stacktrace from production.log

# Logfile created on Sun Dec 23 07:37:56 -0700 2007 by /
undefined method `downcase' for nil:NilClass
/home/ninecons/rails/inventory/vendor/rails/actionpack/lib/
action_controller/request.rb:22:in
`method'
/home/ninecons/rails/inventory/vendor/rails/actionpack/lib/
action_controller/routing.rb:1366:in
`extract_request_environment'
/home/ninecons/rails/inventory/vendor/rails/actionpack/lib/
action_controller/routing.rb:1315:in
`recognize'
/home/ninecons/rails/inventory/vendor/rails/railties/lib/
dispatcher.rb:40:in
`dispatch'
./dispatch.rb:10

That implies that REQUEST_METHOD isn't being set in the environment by
whoever is invoking your stuff. Don't know why that would be.

Fred

I’ve read that this may be a problem with the default routes, but my default routes work well with my previous server installation, so I don’t believe that is an issue

Todd Nine wrote:

Hi all,
  I have a rails 1.5.2 application. I've frozen the application via the
"rake rails:freeze:gems" command. This application worked well on a
server
I previously had it installed on. My server was getting really slow,
and I
requested that I be moved to a new server. When I perform a "gem list
rails" command on my new host, I receive only version 1.2.6. Since I
froze
my app with 1.2.5, will it need other gems that won't be installed on
the
server since it only has version 1.2.6? Its deployed on a shared host
at
bluehost, which uses apache 1.3.39 and fcgi. If I run the dispatch.rb,
or
dispatch.fcgi from the command line I get the same error. I'm a bit of
a
RoR deployment noob, so your help is greatly appreciated.

I tracked this problem down to the fact that SELinux prohhibited
environment variables to be propagated from httpd to the ruby process.
The band aid solution is to turn off selinux enforcement by issuing the
"/usr/sbin/setenforce 0" command

The long term fix is to update the selinux rules to allow for exactly
that. I patched my SELinux policy targeted, the srpm can be downloaded
here:
http://resare.com/noa/rpms/centos/4/SRPMS/selinux-policy-targeted-1.17.30-2.149.1.centos4.src.rpm

Good luck!
/noa