annotate is getting confused by namespaced models #71

Closed
fabiob opened this Issue Feb 7, 2012 · 6 comments

Projects

None yet

5 participants

fabiob commented Feb 7, 2012

I have several projects that use namespaced models. Some of those models have the same name as a non-namespaced one (i.e.: a User model and a Legacy::User model).

Annotate 2.4.0 did its job well in those cases. I just upgraded to the Github version today (needed the #56 fix), and it is no longer working on those cases: it applies the non-namespaced model annotations to my namespaced model.

I have the same issue. I am on "2.4.1.beta1 a43c08f"

Contributor
KL-7 commented Apr 17, 2012

@lulalala, could you, please, check whether the same issue exists with changes from #70 pull request? You'll need to point your Gemfile to load-models-from-object-space branch of my fork.

@KL-7, thanks I tried it, but it gives errors like:
Unable to annotate city.rb: #<NoMethodError: undefined method<' for nil:NilClass>` for all models

Contributor
KL-7 commented Apr 18, 2012

@lulalala, does modules nesting of your models match directories structure inside app/models?

@KL-7 it does, and even models in the app/models level has this error too.

If you have model with the same name outside and inside the namespace, Rails wouldn't autoload the latter. So, let's just not relay on Rails autoload. This may be a bit slower, but no more mess in annotations. Here is the fix — roundlake@a443749

@ctran ctran closed this Nov 30, 2013
@ctran ctran added the released label Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment