Module: Foreigner::SchemaDumper

Extended by:
ActiveSupport::Concern
Defined in:
lib/foreigner/schema_dumper.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#tables_with_foreign_keys(stream) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/foreigner/schema_dumper.rb', line 29

def tables_with_foreign_keys(stream)
  tables_without_foreign_keys(stream)
  @connection.tables.sort.each do |table|
    next if ['schema_migrations', ignore_tables].flatten.any? do |ignored|
      case ignored
      when String; table == ignored
      when Regexp; table =~ ignored
      else
        raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.'
      end
    end
    foreign_keys(table, stream)
  end
end