Sha256: 35e10ba95cb0b6dfd022c173ad4b1b632c141b88b672761fc6d86216c5642125

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 Bytes

Contents

module SchemaPlusIndexes
  module ActiveRecord
    module ConnectionAdapters
      module AbstractAdapter

        def self.included(base) #:nodoc:
          base.alias_method_chain :remove_index, :schema_plus_indexes
        end

        # Extends rails' remove_index to include this options:
        #   :if_exists
        def remove_index_with_schema_plus_indexes(table_name, *args)
          options = args.extract_options!
          if_exists = options.delete(:if_exists)
          args << options if options.any?
          return if if_exists and not index_name_exists?(table_name, options[:name] || index_name(table_name, *args), false)
          remove_index_without_schema_plus_indexes(table_name, *args)
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schema_plus_indexes-0.1.1 lib/schema_plus_indexes/active_record/connection_adapters/abstract_adapter.rb
schema_plus_indexes-0.1.0 lib/schema_plus_indexes/active_record/connection_adapters/abstract_adapter.rb