Class: ActiveRecord::ConnectionAdapters::TableDefinition

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

Instance Method Summary collapse

Instance Method Details

#column_with_enumerated_attribute(name, type, options = {}) ⇒ Object



7
8
9
10
# File 'lib/enumerated_attribute/rails_helpers.rb', line 7

def column_with_enumerated_attribute(name, type, options = {})
	type = 'string' if type.to_s == 'enum'
	column_without_enumerated_attribute(name, type, options)
end

#enum(*args) ⇒ Object



13
14
15
16
17
# File 'lib/enumerated_attribute/rails_helpers.rb', line 13

def enum(*args)
	options = args.extract_options!                                      
	column_names = args                                                   
	column_names.each { |name| column(name, 'string', options) }  
end