Skip to content

Commit

Permalink
Monkey patch rails_erd to work with Rails 6.1
Browse files Browse the repository at this point in the history
Until voormedia/rails-erd#358 is resolved,
rails-erd cannot generate ERD data from the models on Rails 6.1.

This patch reoslves the above by monkey-patching in a fix that has
been proposed upstream.
  • Loading branch information
ChrisMacNaughton committed Jan 12, 2021
1 parent c0b497e commit a5b93ce
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/initializers/rails_erd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

if Rails.env.development?
require 'rails_erd/domain'

module RailsERD
class Domain
def name
return unless defined?(Rails) && Rails.application

if Rails.application.class.respond_to?(:module_parent)
Rails.application.class.module_parent.name
else
Rails.application.class.parent.name
end
end
end
end
end

0 comments on commit a5b93ce

Please sign in to comment.