Sha256: fbac01f057c60f07944cf44f2e4972b0bf616fd285aa323cfd678951dcf055ec

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module ActiveRecord
  module PGEnum
    def self.install_table_definition
      require "active_record/connection_adapters/postgresql_adapter"
      ActiveRecord::ConnectionAdapters::PostgreSQL::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

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-pg_enum-0.4.0 lib/active_record/pg_enum/table_definition.rb