diff --git a/lib/rails_erd/diagram/graphviz.rb b/lib/rails_erd/diagram/graphviz.rb index 9213cef4..3a29cc97 100644 --- a/lib/rails_erd/diagram/graphviz.rb +++ b/lib/rails_erd/diagram/graphviz.rb @@ -310,7 +310,12 @@ def specialization_options(specialization) end def read_template(type) - ERB.new(File.read(File.expand_path("templates/#{NODE_LABEL_TEMPLATES[type]}", File.dirname(__FILE__))), nil, "<>") + template_text = File.read(File.expand_path("templates/#{NODE_LABEL_TEMPLATES[type]}", File.dirname(__FILE__))) + if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ + ERB.new(template_text, trim_mode: "<>") + else + ERB.new(template_text, nil, "<>") + end end end end