This project is archived and is in readonly mode.

#2579 ✓resolved
Tim Connor

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

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>

Referenced by

Pages