Module: SimpleFormObject

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Model
Defined in:
lib/simple_form_object.rb,
lib/simple_form_object/version.rb

Defined Under Namespace

Modules: ClassMethods Classes: Attribute

Constant Summary collapse

VERSION =
"0.0.5"

Instance Method Summary collapse

Instance Method Details

#attributesObject



41
42
43
44
45
46
47
# File 'lib/simple_form_object.rb', line 41

def attributes
  attribs = {}
  self.class._attributes.each do |a|
    attribs[a.name] = self.send(a.name)
  end
  attribs
end

#column_for_attribute(attribute) ⇒ Object



30
31
32
# File 'lib/simple_form_object.rb', line 30

def column_for_attribute(attribute)
  self.class._attribute(attribute).fake_column
end

#initialize(attributes = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/simple_form_object.rb', line 34

def initialize(attributes={})
  super
  self.class._attributes.each do |attribute|
    attribute.apply_default_to(self)
  end
end