This has been an occasional annoyance when setting up new Rails projects with the
rails-erd gem.
The documentation for the gem is to add
gem 'rails-erd', :require=>false
into the Gemfile, and then run
rails g erd:install to add the hook to run when a
rails db:migrate is carried out.
I found that this creates
/lib/tasks/auto_generate_diagram.rake containing
if Rails.env.development?
RailsERD.load_tasks
end
One solution is to remove the
:require=>false from the Gemfile, but apparently this may have an impact on efficiency
rails erd issue 282.
I tried a slightly different approach, and changed
/lib/tasks/auto_generate_diagram.rake to require the gem.
if Rails.env.development?
require 'rails-erd'
RailsERD.load_tasks
end