I introduced erd to output ER diagrams in rails, but I got an error.

Asked 1 years ago, Updated 1 years ago, 496 views

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.

ruby-on-rails rails-activerecord

2022-12-09 08:09

1 Answers

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


2022-12-10 07:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.