Skip to content

Allow use of fallback class loading solution #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2017
Merged

Allow use of fallback class loading solution #473

merged 2 commits into from
Jun 2, 2017

Conversation

pboling
Copy link
Contributor

@pboling pboling commented Jun 2, 2017

LoadError is the critical one to rescue here, but it does not descend from StandardError so the fallback loading is never invoked.

>> LoadError.ancestors
=> [LoadError, ScriptError, Exception, Object, Kernel, BasicObject]

BEFORE THIS FIX:

$ bundle exec annotate
D, [2017-06-02T13:02:41.484425 #16758] DEBUG -- :   ActiveRecord::SchemaMigration Load (0.2ms)  SELECT `schema_migrations`.* FROM `schema_migrations` /*application:Tophatter*/
/Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:495:in `load_missing_constant': Unable to autoload constant CsvRequest, expected /Users/pboling/Documents/tophatter/app/models/csv_request.rb to define it (LoadError)
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:184:in `const_missing'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:261:in `const_get'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:261:in `block in constantize'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `each'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `inject'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `constantize'
	from /Users/pboling/.rvm/gems/ruby-2.2.6/gems/annotate-2.7.2/lib/annotate/annotate_models.rb:615:in `get_loaded_model'

After this fix:

$ bundle exec annotate
Annotated (###): app/models/...

then

$ bundle exec annotate
Model files unchanged.

pboling added 2 commits June 2, 2017 13:11
LoadError is the critical one to rescue here, but it does not descend from `StandardError` so the fallback loading is never invoked.
```
>> LoadError.ancestors
=> [LoadError, ScriptError, Exception, Object, Kernel, BasicObject]
```
Allow use of the fallback loading solution
@ctran ctran merged commit c24f64c into ctran:develop Jun 2, 2017
@ctran
Copy link
Owner

ctran commented Jun 2, 2017

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants