This project is archived and is in readonly mode.
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
-
Geoff Buesing September 1st, 2009 @ 01:07 AM
I'm having a problem uploading my patchfile to Lighthouse -- but this is what the change looks like:
def framework_version(framework) if Object.const_defined?(framework.classify) require "#{framework}/version" "#{framework.classify}::VERSION::STRING".constantize end end
-
Geoff Buesing September 1st, 2009 @ 04:45 AM
- no changes were found...
-
Repository September 1st, 2009 @ 10:30 AM
- State changed from new to committed
(from [cc1efe7e5af32789a9ed0f80528e629861dbe6a7]) Rails::Info doesn't require version for unwanted frameworks
[#3124 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/cc1efe7e5af32789a9ed0f80528e62... -
Repository September 1st, 2009 @ 10:30 AM
(from [6bf17770af2a563b037b961a8dbe84f63f9c929c]) Rails::Info doesn't require version for unwanted frameworks
[#3124 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/6bf17770af2a563b037b961a8dbe84...
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
- 3124 Rails::Info requires version for unwanted frameworks [#3124 state:committed]
- 3124 Rails::Info requires version for unwanted frameworks [#3124 state:committed]