Sha256: 94db3bbaca693047bb13699bc27d3297100b95f4677315e361662c0147347a7e

Contents?: true

Size: 920 Bytes

Versions: 7

Compression:

Stored size: 920 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)

            # For >= AR 6.1.0
            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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ridgepole-0.9.4 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.3 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.2 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.1 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.0 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.0.rc1 lib/ridgepole/ext/abstract_adapter/disable_table_options.rb
ridgepole-0.9.0.beta lib/ridgepole/ext/abstract_adapter/disable_table_options.rb