Sha256: 74d1eb39407b6c0c65ec9f7f7174cdd5d37ac5ae3f5b316527450e533ca4d4cc

Contents?: true

Size: 903 Bytes

Versions: 9

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require 'active_record/connection_adapters/abstract_adapter'

module Ridgepole
  module Ext
    module AbstractAdapter
      module DisableTableOptions
        def without_table_options(value)
          @__without_table_options = value
          yield
        ensure
          remove_instance_variable(:@__without_table_options)
        end

        def table_options(table_name)
          options = super

          if options && @__without_table_options
            options.delete(:options)
            options.delete(:charset)
            options.delete(:collation)
          end

          options
        end
      end
    end
  end
end

module ActiveRecord
  module ConnectionAdapters
    class AbstractAdapter
      def self.inherited(subclass)
        subclass.prepend Ridgepole::Ext::AbstractAdapter::DisableTableOptions
        super
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ridgepole-3.0.0 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.1.1 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.1.0 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.3 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.2 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.1 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.0 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.0.beta2 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-2.0.0.beta lib/ridgepole/ext/abstract_adapter/disable_table_options.rb