Sha256: 9865e5ea86842d5f16f9d721362e209f1e90f0dbb80fd1454ebff4b2acc972e5

Contents?: true

Size: 443 Bytes

Versions: 11

Compression:

Stored size: 443 Bytes

Contents

module ActiveRecord
  module PGEnum
    register :column_options do
      require "active_record/connection_adapters/postgresql_adapter"
      ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend PrepareColumnOptions
    end

    module PrepareColumnOptions
      def prepare_column_options(column, types)
        spec = super
        spec[:as] = column.sql_type.inspect if column.type == :enum
        spec
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
activerecord-pg_enum-2.0.0 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.2.2 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.2.1 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.2.0 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.1.0 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.5 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.4 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.3 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.2 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.1 lib/active_record/pg_enum/4.1/prepare_column_options.rb
activerecord-pg_enum-1.0.0 lib/active_record/pg_enum/4.1/prepare_column_options.rb