Sha256: 669d3015845c2e06bc43ba18a990fdc40de73f7432429f02a0c7b7b4ccf08868

Contents?: true

Size: 559 Bytes

Versions: 4

Compression:

Stored size: 559 Bytes

Contents

module ActiveRecord
  module PGEnum
    register :table_definition do
      require "active_record/connection_adapters/postgresql_adapter"
      ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition.include TableDefinition
    end

    module TableDefinition
      # Create an enum column inside a TableDefinition
      #
      # Example:
      #
      #   create_table :orders do |t|
      #     t.enum :status, as: "status_type"
      #   end
      def enum(name, as:, **options)
        column(name, as, options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-pg_enum-1.0.3 lib/active_record/pg_enum/4.1/table_definition.rb
activerecord-pg_enum-1.0.2 lib/active_record/pg_enum/4.1/table_definition.rb
activerecord-pg_enum-1.0.1 lib/active_record/pg_enum/4.1/table_definition.rb
activerecord-pg_enum-1.0.0 lib/active_record/pg_enum/4.1/table_definition.rb