Module: AttributeColumn

Extended by:
ActiveSupport::Concern
Defined in:
lib/attribute_column.rb,
lib/attribute_column/version.rb

Defined Under Namespace

Modules: ClassMethods Classes: Attribute

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.generate(options) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/attribute_column.rb', line 13

def self.generate(options)
  type = options[:type]
  attribute = Attribute.new(options)
  case type
  when :string
    attribute.limit = 255
  when :integer, :float
    attribute.number =  true
  end
  attribute
end

Instance Method Details

#column_for_attribute(attribute) ⇒ Object



35
36
37
# File 'lib/attribute_column.rb', line 35

def column_for_attribute(attribute)
  self.class.columns_hash[attribute]
end