Sha256: 16d3afd648688db8774056f8ce8d08d4cdc056595a013af7fa08377945b712c6

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module ActiveRecord
  module PGEnum
    def self.install_column_options
      require "active_record/connection_adapters/postgresql/schema_dumper"
      ActiveRecord::ConnectionAdapters::PostgreSQL::ColumnDumper.prepend PrepareColumnOptions
    end

    module PrepareColumnOptions
      def prepare_column_options(column)
        super.tap do |spec|
          if column.type == :enum
            spec[:as] = column.sql_type
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-pg_enum-0.4.0 lib/active_record/pg_enum/5.0/prepare_column_options.rb