config/initializers/new_rails_defaults.rb should check for disabled frameworks
Reported by Jesper Hvirring Henriksen | June 2nd, 2008 @ 04:10 PM
In 2.1.0, if ActiveRecord is disabled in config/environment.rb using e.g.
config.frameworks -= [ :active_record ]
script/server fails to launch:
[test_new_rails_features]$ script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.1.0 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError)
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in `const_missing'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:479:in `const_missing'
from /Users/jesper/Projects/rails/test_new_rails_features/config/initializers/new_rails_defaults.rb:5
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/initializer.rb:475:in `load_application_initializers'
... 32 levels...
from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3
The culprit is config/initializers/new_rails_defaults.rb, which should test to see if ActiveRecord is loaded.
Will create and submit a patch ASAP...
Comments and changes to this ticket
-
Jesper Hvirring Henriksen June 2nd, 2008 @ 04:23 PM
- → Title changed from configs/initializers/new_rails_defaults.rb should check for disabled frameworks to config/initializers/new_rails_defaults.rb should check for disabled frameworks
The attached patch wraps calls to ActiveRecord::Base and ActiveSupport in "if defined?" blocks.
-

Repository June 2nd, 2008 @ 06:43 PM
- → State changed from new to resolved
(from [4b4aa8f6e08ba2aa2ddce56f1d5b631a78eeef6c]) AR can be disabled, new_rails_defaults.rb should check [#303 state:resolved] (Jesper Hvirring Henriksen)
-

Repository June 2nd, 2008 @ 07:01 PM
(from [3d5bf096e85deb3d3da15c760598a7db5f381b3c]) AR can be disabled, new_rails_defaults.rb should check [#303 state:resolved] (Jesper Hvirring Henriksen)
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
The latest development for the 1.2.x and 2.0.x releases are on the 1-2-stable and 2-0-stable branches.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
