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"
@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
Unable to annotate city.rb: #<NoMethodError: undefined method
@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