Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

config/initializers/new_rails_defaults.rb should check for disabled frameworks

#303

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...

Reported by Jesper Hvirring Henriksen · June 2nd, 2008 @ 10:10 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Jesper Hvirring Henriksen
    Jesper Hvirring Henriksen
    • 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.

    June 2nd, 2008 @ 10:23 PM

  2. Repository
    Repository
    • State changed from new to resolved

    (from [4b4aa8f6e08ba2aa2ddce56f1d5b631a78eeef6c]) AR can be disabled, new_rails_defaults.rb should check [#303 state:resolved] (Jesper Hvirring Henriksen)

    http://github.com/rails/rails/co...

    June 3rd, 2008 @ 12:43 AM

  3. Repository
    Repository

    (from [3d5bf096e85deb3d3da15c760598a7db5f381b3c]) AR can be disabled, new_rails_defaults.rb should check [#303 state:resolved] (Jesper Hvirring Henriksen)

    http://github.com/rails/rails/co...

    June 3rd, 2008 @ 01:01 AM