This project is archived and is in readonly mode.

#3124 ✓committed
Geoff Buesing

Rails::Info requires version for unwanted frameworks

Reported by Geoff Buesing | September 1st, 2009 @ 01:05 AM

Currently, Rails::Info will attempt to load framework/version for all frameworks, even ones that have been opted out of via config.frameworks -=.

Problems arise because the top level framework constant, e.g. ActiveRecord, is defined when active_record/version is required, and this messes with detection of the framework's existence via:

defined?(ActiveRecord)

...which is done in ActionController::Dispatcher.define_dispatcher_callbacks, rake db:test:prepare, and in many external libraries. Things break, because these libraries aren't actually loaded, just the bare module with the VERSION module included.

The problem only happens when Rails::Info is called, either via the default rails info page, or when required by a library. One particularly popular external library that requires Rails::Info: the New Relic RPM plugin.

To fix this, I'm just checking to see if the constant is defined before requiring 'framework_name/version'. Another way to fix this would be, to use Rails.configuration.frameworks.

I couldn't figure out a way to write a proper test for this.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Referenced by

Pages