Sha256: 78744dbc47997e2af574e6856ab6c5bf2d7cb7f066aa86c03dff3c9f465f655a

Contents?: true

Size: 442 Bytes

Versions: 11

Compression:

Stored size: 442 Bytes

Contents

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

    module PrepareColumnOptions
      def prepare_column_options(column)
        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/5.0/prepare_column_options.rb
activerecord-pg_enum-1.2.2 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.2.1 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.2.0 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.1.0 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.5 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.4 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.3 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.2 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.1 lib/active_record/pg_enum/5.0/prepare_column_options.rb
activerecord-pg_enum-1.0.0 lib/active_record/pg_enum/5.0/prepare_column_options.rb