217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
# File 'lib/formotion/form/form.rb', line 217
def values=(data)
self.sections.each {|section|
if section.select_one?
unless (section.rows.map{ |r| r.key } & data.keys).empty?
section.rows.each { |row|
row.value = data.has_key?(row.key) ? true : nil
}
end
else
section.rows.each {|row|
next if row.button?
if row.template_parent
row.value = data[row.template_parent_key] if data.has_key?(row.template_parent_key)
elsif row.subform
row.subform.to_form.values = data
else
row.value = data[row.key] if data.has_key?(row.key)
end
}
end
}
end
|