This project is archived and is in readonly mode.
dependencies marks regular constants as autoloaded
Reported by Xavier Noria | July 21st, 2010 @ 12:48 AM | in 3.0.2
This happens when there are 2 or more const_missings in a row:
fxn@rails:~/tmp/autoload$ cat lib/m.rb
module M
end
fxn@rails:~/tmp/autoload$ cat app/models/a.rb
module A
end
B
fxn@rails:~/tmp/autoload$ cat app/models/b.rb
require 'm'
module B
end
fxn@rails:~/tmp/autoload$ sr 'A; p ActiveSupport::Dependencies.autoloaded_constants'
["B", "M", "A"]
See the "M" there?
As a consequence, that M will be removed in dev mode, but never loaded again because "m.rb" correctly belongs to $" after that.
Interestingly, if you move the require line from b.rb to a.rb and execute the same runner script, M is not marked as autoloaded, albeit it was a new constant resulting from autoloading A. Which is the correct behavior.
This is a regression, 2.3 does not have this issue.
Comments and changes to this ticket
-
Xavier Noria July 21st, 2010 @ 12:54 AM
- Importance changed from Low to High
-
Repository July 26th, 2010 @ 09:00 AM
- State changed from new to resolved
(from [1b97701e51667e6040b4c576cce9234edef1019e]) Fix a bug where requires inside of autoloads were being added to the autoloaded_constants list, causing mayhem. [#5165 state:resolved] http://github.com/rails/rails/commit/1b97701e51667e6040b4c576cce923...
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
Referenced by
- 5165 dependencies marks regular constants as autoloaded (from [1b97701e51667e6040b4c576cce9234edef1019e]) Fix a b...