annotate_models
annotate_models copied to clipboard
model_dir Not working on rails 6.1
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
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
.
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."