Class: Formotion::FormableController

Inherits:
FormController show all
Extended by:
BW::KVO
Includes:
BW::KVO
Defined in:
lib/formotion/controller/formable_controller.rb

Instance Attribute Summary collapse

Attributes inherited from FormController

#form

Instance Method Summary collapse

Methods inherited from FormController

#initWithForm, #pop_subform, #push_subform, #viewDidLoad, #viewWillAppear

Instance Attribute Details

#modelObject

Returns the value of attribute model.



6
7
8
# File 'lib/formotion/controller/formable_controller.rb', line 6

def model
  @model
end

Instance Method Details

#initWithModel(model) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/formotion/controller/formable_controller.rb', line 8

def initWithModel(model)
  self.initWithForm(model.to_form)
  self.model = model
  self.form.sections.each { |section|
    section.rows.each { |row|
      observe(row, "value") do |old_value, new_value|
        self.model.send("#{row.key}=", new_value)
      end
    }
  }
  self
end