annotate_models icon indicating copy to clipboard operation
annotate_models copied to clipboard

model_dir Not working on rails 6.1

Open edugonch opened this issue 4 years ago • 2 comments

I have an app with an engine, I add the engine dir to model_dir configuration. 'model_dir' => "app/models,components/core/app/models/core",

When trying to annotate the models nothing happen

Commands

$ rails annotate_models
Model files unchanged.
$ rails annotate_models --model-dir 'components/core/app/models/core'
invalid option: --model-dir
$ rails annotate
rails aborted!
Don't know how to build task 'annotate' (See the list of available tasks with `rails --tasks`)
Did you mean?  annotate_routes

Version

  • annotate version: 3.1.1-release
  • rails version: 6.1.1
  • ruby version: 2.7.2p137

edugonch avatar Jan 30 '21 19:01 edugonch

Hi edugonch,

After running into many problems with annotate myself, I have developed the gem datagaze which fixes those issues.

I expect that the gem might also resolve your issue. Would you like to try it out, and let me know if it has solved your problem?

The gem is to be found at: https://github.com/jurriaanschrofer/datagaze.

Background story of the gem: annotate's lookup system is often rigid and based on very strict conventions. Instead, I have devised a more dynamic way of annotating, through the use of ruby's const_source_location method and rails' ApplicationRecord.descendants.

jurriaanschrofer avatar Oct 04 '21 22:10 jurriaanschrofer

Similar issue still with Rails 7. Have pretty standard engine, with migrations and models. Nothing happens whatever options I try for --models --model-dir - always ends with "Model files unchanged."

autotelik avatar May 11 '23 10:05 autotelik