Method: Formotion::Form#init_observer_for_save
- Defined in:
- lib/formotion/form/form.rb
#init_observer_for_save ⇒ Object
loads the given settings into the the form, and places observers to save on changes
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/formotion/form/form.rb', line 251 def init_observer_for_save @form_save_observer ||= lambda { |form| form.sections.each_with_index do |section, s_index| section.rows.each_with_index do |row, index| if row.subform? @form_save_observer.call(row.subform.to_form) elsif !row.templated? observe(row, "value") do |old_value, new_value| self.save end end end end } @form_save_observer.call(self) end |