Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8349 (new defect)

Opened 2 years ago

Last modified 1 year ago

[PATCH] script/about broken in production mode

Reported by: fxn Assigned to: core
Priority: normal Milestone: 2.x
Component: Railties Version: 1.2.3
Severity: minor Keywords:
Cc:

Description

script/about crashes in production mode:

$ RAILS_ENV=production && script/about 
./script/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:263:in
`load_missing_constant': uninitialized constant Rails::Info (NameError)
...

The reason is that the directory where it lives is added to $LOAD_PATH by the initializer only in development mode.

Since the Rails::InfoController only outputs actual data to local requests, I see no apparent reason not to be able to load it in production. So, a patch that removes the condition in the initializer comes attached, script/about runs fine then.

Attachments

fix_builtin_directories.patch (422 bytes) - added by fxn on 05/12/07 19:18:33.

Change History

05/12/07 19:18:33 changed by fxn

  • attachment fix_builtin_directories.patch added.

05/12/07 22:52:24 changed by fxn

  • summary changed from script/about broken in production mode to [PATCH] script/about broken in production mode.

05/14/07 15:13:36 changed by fxn

  • version changed from edge to 1.2.3.

11/13/07 19:41:10 changed by Toebee

I also get dependencies.rb:263:in `load_missing_constant': uninitialized constant Rails::Info (NameError) when I enter script/about on the server (Rails 1.99.0). I'd like to vote for fixing the issue.

05/06/08 09:14:30 changed by timdiggins

NB - in the meantime:

quick hack to get script/about working for one webapp, without patching rails itself:

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
module Rails
  class Configuration
    def builtin_directories 
      # Include builtins even in production environment. 
      Dir["#{RAILTIES_PATH}/builtin/*/"] 
    end 
  end
end
require 'commands/about'

06/07/08 22:00:17 changed by chovy

over a year and no fix :(

Tim -- what do I do with the script you posted?

Add it to ./script/about? execute it by itself?

Also, ./script/about RAILS_ENV='production' doesn't work from my local box either, so there's no way for me to know why my code isn't showing up (ie: incorrect schema version)...as the book "Deploying Rails with Capistrano" suggests.

06/07/08 22:06:14 changed by chovy

answered my own questions -- ps that only works on the prod server itself.

./script/about RAILS_ENV='production' doesn't display prod stats.