This project is archived and is in readonly mode.
requires in metals choke on second request in development reloading mode
Reported by Tim Connor | April 28th, 2009 @ 10:42 PM | in 2.x
Metals aren't handles by the usual dependency handling of rails, since they are manually required in Rails::Rack::Metal
if metal = all_metals[requested_metal]
require metal
requested_metal.constantize
end
This means that if your metal depends on any constants in the Rails project, it will choke on the second request, since they will have been unloaded, but they don't get reloaded for the metal request.
If you try and force the load in metal, via a require of the Model/Module/etc, then you get a double require (and the associated warnings about redefining constants, if you have any defined in said Model), since it is loaded by both the metal and rails standard dependency loading. If you try using require_dependency you are back to square one of choking on the second development request.
I would consider just patching it to require_dependency metal, but I am not sure for the reason for it not being, and what low level assumptions there may be about it being "metal" and lower level than AS::Dependency.
Let me know if there is anything I can do to clarify this.
Comments and changes to this ticket
-
Tim Connor April 28th, 2009 @ 11:03 PM
Not sure if this is the right solutions (didn't see where to put any tests for the rack level stuff), but this solves the problem for me:
-
Tim Connor May 5th, 2009 @ 12:01 AM
fyi, this does NOT break reloading for me with metal in dev mode, in fact it fixes it.
-
Tim Connor May 5th, 2009 @ 01:08 AM
No rush, I just noticed today that it actually did work right with dev mode reloading, on my set-up, despite bitsweat saying something about it not.
You probably will want to verify that it works right on your end. ;)
-
Repository May 5th, 2009 @ 02:18 AM
- State changed from open to resolved
(from [49169f7a6ab2699c500032e6e14570512c674274]) fix problems with requires in metal choking under development reloading [#2579 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
Repository May 5th, 2009 @ 02:18 AM
(from [e3891601d137a400722cfd0f941b9195b0a8217b]) fix problems with requires in metal choking under development reloading [#2579 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
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
Tags
Referenced by
- 2579 requires in metals choke on second request in development reloading mode (from [49169f7a6ab2699c500032e6e14570512c674274]) fix pro...
- 2579 requires in metals choke on second request in development reloading mode (from [e3891601d137a400722cfd0f941b9195b0a8217b]) fix pro...