Class: ActiveRecord::ConnectionAdapters::TableDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord_enum.rb

Instance Method Summary collapse

Instance Method Details

#enum(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/activerecord_enum.rb', line 18

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

#set(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/activerecord_enum.rb', line 28

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