I introduced erd to output ER diagrams in rails, but I got an error.
This is the procedure I tried.
Create an ER diagram automatically with Rails ERD!Options included
However, the erd
command also generates an error "Failed:NameError:uninitialized constant RailsERD::CLI::ActiveRecord".
bundle execred filetype=dot
Loading application in 'filetype=dot'...
Tried to load your application environment from 'filetype=dot/config/environment.rb'but the file was not present.
This means that your models right not get loaded fully when the diagram gets built. This can
make your entity diagram incomplete.
However, if you are using ActiveRecord without Rails just make sure your models get
loaded early before we generate the ERD (for example, explicit require your application)
bootstrap file before calling rails-erd from your Rakefile).We will continue without loading the environment file,
and recommend you check your diagram for missing models after it gets generated.
Failed:NameError:uninitialized constant RailsERD::CLI:::ActiveRecord
$stderr.puts "Generating entity-relationship diagram for #{ActiveRecord::Base.descendants.length} models..."
I couldn't initialize the ActiveRecord error statement, so when I looked into the that occurred, I didn't get any information.
Searching for a way to respond to the error.
As mentioned in the referenced article, it seems that Graphviz needs to be installed in the output of the ER diagram.Have you introduced this beforehand?
Also, if you search by error message, the following issue will be hit.One of the comments mentioned Graphviz and reported that it worked by installing it.
Unable to generate ERD·Issue#164·voormedia/rails-erd
run bundle execerd
in the root of the application
before that do,
sudo apt-get install graphviz graphviz-dev
gem install ruby-graphviz
It works for me
© 2024 OneMinuteCode. All rights reserved.