Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spohlenz/as-autoload
Demonstration of bug in ActiveSupport::Dependencies
https://github.com/spohlenz/as-autoload
Last synced: 28 days ago
JSON representation
Demonstration of bug in ActiveSupport::Dependencies
- Host: GitHub
- URL: https://github.com/spohlenz/as-autoload
- Owner: spohlenz
- Created: 2011-05-31T12:10:46.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-05-31T12:14:09.000Z (over 13 years ago)
- Last Synced: 2023-04-11T03:11:14.452Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
Demonstration of autoloading issue in ActiveSupport::Dependencies.
Edit Gemfile to switch between patched and unpatched versions of ActiveSupport.# Simple case: load class within first folder
# #
puts Blog::Post.new.inspect# Another simple case: load nested class within folders
# #
puts Blog::Admin::PostsController.hardcoded.inspect# It gets complicated: attempts to load Blog::Admin::Post (similar to inherited_resources)
# We would expect either a NameError or have it return Blog::Post. Instead we get:
# /Users/sam/.rvm/gems/ruby-1.9.2-p180/bundler/gems/rails-12786518f1f7/
# activesupport/lib/active_support/dependencies.rb:476:in `load_missing_constant':
# Blog is not missing constant Post! (ArgumentError)
puts Blog::Admin::PostsController.autodetect.inspect# Interestingly, this last line works if we run it first (before Blog::Post is loaded)
# but then fails if we run it again (since Blog::Post is now loaded).