diff --git a/lib/rails-mermaid_erd/builder.rb b/lib/rails-mermaid_erd/builder.rb index 918c519..13fc502 100644 --- a/lib/rails-mermaid_erd/builder.rb +++ b/lib/rails-mermaid_erd/builder.rb @@ -13,6 +13,7 @@ def model_data next unless defined_model.table_exists? next if defined_model.name.include?("HABTM_") next if defined_model.table_name.blank? + next if RailsMermaidErd.configuration.ignore.select { |i| Regexp.new(i).match(defined_model.table_name) }.present? table_name = defined_model.table_name model = { diff --git a/lib/rails-mermaid_erd/configuration.rb b/lib/rails-mermaid_erd/configuration.rb index 74fd25b..b4afac2 100644 --- a/lib/rails-mermaid_erd/configuration.rb +++ b/lib/rails-mermaid_erd/configuration.rb @@ -1,11 +1,12 @@ require "yaml" class RailsMermaidErd::Configuration - attr_accessor :result_path + attr_accessor :result_path, :ignore def initialize config = { - result_path: "mermaid_erd/index.html" + result_path: "mermaid_erd/index.html", + ignore: [] } config_file = Rails.root.join("config/mermaid_erd.yml") @@ -15,5 +16,6 @@ def initialize end @result_path = config[:result_path] + @ignore = config[:ignore] end end