Problem with switching rails 2.2.2. application to production

Problem with switching rails 2.2.2. application to production:

When I uncomment the following two statements or only the first one
from environment.rb,
###ENV['RAILS_ENV'] = 'production'
###RAILS_ENV = ENV['RAILS_ENV']

Then I run in /public,
ruby dispatch.fcgi

I keep get the following:
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- application
(MissingSourceFile)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/dependencies.rb:155:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/dependencies.rb:262:in `require_or_load'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/dependencies.rb:221:in `depend_on'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/dependencies.rb:133:in `require_dependency'
        from /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/
action_controller/dispatcher.rb:18:in `define_dispatcher_callbacks'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:182:in `call'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:182:in `evaluate_method'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:166:in `call'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:90:in `run'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:90:in `each'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:90:in `send'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:90:in `run'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/
active_support/callbacks.rb:277:in `run_callbacks'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:559:in `send'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:559:in `prepare_dispatcher'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:173:in `process'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:112:in `send'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:112:in `run'
        from ./../config/environment.rb:19
        from dispatch.fcgi:22:in `require'
        from dispatch.fcgi:22

Can you post your config/environment.rb file please.

Cheers,
Nicholas

Thanks for your response Nicholas. Sorry for the delay in replying; my
web host had security issues with SSH.

Here is the information. Any help would be appreciated.

/config/environment.rb (I have not shown most commented lines:

ENV['RAILS_ENV'] = 'production'
RAILS_ENV = ENV['RAILS_ENV']

# Specifies gem version of Rails to use when vendor/rails is not
present
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default
configuration
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|

config.logger = Logger.new(config.log_path, 10, 1024**2)

  config.action_controller.session = {
    :session_key => '_aks_session',
    :secret => 'd8…….6e'
  }

  config.action_controller.session_store = :active_record_store

end

I “froze” to rails 2.2.2
/vendor/rails/railties/lib/rails/version.rb:
module Rails
  module VERSION #:nodoc:
    MAJOR = 2
    MINOR = 2
    TINY = 2

    STRING = [MAJOR, MINOR, TINY].join('.')
  end
end

ruby script/about yields:

About your application's environment
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.4
Rails version 2.2.2
Active Record version 2.2.2
Action Pack version 2.2.2
Active Resource version 2.2.2
Action Mailer version 2.2.2
Active Support version 2.2.2
Edge Rails revision unknown
Application root /home/aksrefle/aksprod
Environment development
Database adapter mysql
Database schema version 20090625162758

gem list --local yields:
*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
rails (2.3.2)
rake (0.8.7)

OK, there's nothing in the environment file that sticks out. A couple
of questions:

1. What's the filename of the ApplicationController?
2. Why are you run 'ruby dispatch.fcgi'?

Cheers,
Nicholas

After making changes to environment.rb to switch to production, I had
to stop and restart the server. When you asked why I ran “ruby
dispatch.fcgi”, I did some research and got it working with
“RAILS_ENV=production ./dispatch.fcgi”

Thanks for your help.