Sha256: 8219e6068a1a49f1157bd0de3517694dcb592fbe679d3ba60a0a7ea494d28b15

Contents?: true

Size: 536 Bytes

Versions: 5

Compression:

Stored size: 536 Bytes

Contents

module SchemaAutoForeignKeys
  module Middleware
    module Schema
      module Define
        def around(env)
          fk_override = { :auto_create => false, :auto_index => false }
          save = Hash[fk_override.keys.collect{|key| [key, SchemaPlus::ForeignKeys.config.send(key)]}]
          begin
            SchemaPlus::ForeignKeys.config.update_attributes(fk_override)
            yield env
          ensure
            SchemaPlus::ForeignKeys.config.update_attributes(save)
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
schema_auto_foreign_keys-0.1.3 lib/schema_auto_foreign_keys/middleware/schema.rb
schema_auto_foreign_keys-0.1.2 lib/schema_auto_foreign_keys/middleware/schema.rb
schema_auto_foreign_keys-0.1.1 lib/schema_auto_foreign_keys/middleware/schema.rb
schema_auto_foreign_keys-0.1.0 lib/schema_auto_foreign_keys/middleware/schema.rb
schema_plus-2.0.0.pre16 lib/schema_plus/auto_foreign_keys/middleware/schema.rb