Sha256: 62e3624a33b199d97da6224a28874a2f011c0fd5f8d9c1e6ae1afd51403e0fa3

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'active_record'
require 'active_record/base'
require 'active_record/connection_adapters/abstract/schema_definitions.rb'

require 'connection_adapters/sqlite3' if defined?( SQLite3 )
require 'connection_adapters/mysql2' if defined?( Mysql2 )

if ActiveRecord::VERSION::MAJOR < 4 || (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR <= 1)
  require 'activerecord_enum/activerecord_enum_pre42.rb'
else
  require 'activerecord_enum/activerecord_enum_post42.rb'
end

module ActiveRecord
  module ConnectionAdapters
    class TableDefinition

      def enum *args
        if defined?(ActiveSupport)
          ActiveSupport::Deprecation.warn(
            %q{The 'activerecord_enum' gem has a new name! Please install the 'native_enum' gem instead.}
          )
        end
        options = args.extract_options!
        column_names = args
        column_names.each { |name| column(name, :enum, options) }
      end
      def set *args
        if defined?(ActiveSupport)
          ActiveSupport::Deprecation.warn(
            %q{The 'activerecord_enum' gem has a new name! Please install the 'native_enum' gem instead.}
          )
        end
        options = args.extract_options!
        options[:default] = options[:default].join "," if options[:default].present?
        column_names = args
        column_names.each { |name| column(name, :set, options) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord_enum-0.4.1 lib/activerecord_enum.rb