Skip to content
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

Not finding model AB::Thing in ab/thing.rb #271

Closed
anthonyjsmith opened this issue Aug 10, 2015 · 2 comments
Closed

Not finding model AB::Thing in ab/thing.rb #271

anthonyjsmith opened this issue Aug 10, 2015 · 2 comments
Assignees
Milestone

Comments

@anthonyjsmith
Copy link

I have an app with a model AB::Thing (rails 4.2.3):

rails new TestApp
cd TestApp/
rails g model AB::Thing
# First replace Ab with AB in app/models/ab.rb and app/models/thing.rb
rake db:migrate

Trying to annotate:

echo "gem 'annotate', github: 'ctran/annotate_models', branch: 'develop'" >> Gemfile
bundle
bundle exec annotate

Output:

Unable to annotate app/models/ab/thing.rb: cannot load a model from app/models/ab/thing.rb
Unable to annotate app/models/ab.rb: Unable to autoload constant Ab, expected /Users/anthonys/TestApp/app/models/ab.rb to define it
Nothing to annotate.

Hacking the source code and changing rescue to rescue LoadError in get_loaded_model seems to fix it (not sure if it will break anything else though):

Unable to annotate app/models/ab.rb: cannot load a model from app/models/ab.rb
Annotated (1): AB::Thing

(It's basically caused by the ambiguity between camelize and underscore with multiple uppercase letters.)

@ctran ctran added the reviewed label Dec 8, 2015
@ctran ctran added this to the v2.7.0 milestone Dec 8, 2015
@ctran ctran added the bug label Dec 8, 2015
@ctran ctran self-assigned this Dec 8, 2015
@ctran
Copy link
Owner

ctran commented Dec 27, 2015

This is now working in 2.7.0 (to be released soon)

@ctran ctran closed this as completed Dec 27, 2015
@anthonyjsmith
Copy link
Author

👍

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

No branches or pull requests

2 participants