Public Instance methods
forme_parse(obj)
Return hash based on submitted parameters, with :values key being submitted values for the object, and :validations key being a hash of validation metadata for the object.
[show source]
# File lib/roda/plugins/forme_set.rb 43 def forme_parse(obj) 44 h = _forme_parse(obj) 45 46 params = h.delete(:params) 47 columns = h.delete(:columns) 48 h[:validations] ||= {} 49 50 values = h[:values] = {} 51 columns.each do |col| 52 values[col.to_sym] = params[col] 53 end 54 55 h 56 end
forme_set(obj)
Set fields on the object based on submitted parameters, as well as validations for associated object values.
[show source]
# File lib/roda/plugins/forme_set.rb 60 def forme_set(obj) 61 h = _forme_parse(obj) 62 63 obj.set_fields(h[:params], h[:columns]) 64 65 if h[:validations] 66 obj.forme_validations.merge!(h[:validations]) 67 end 68 69 if block_given? 70 yield h[:form_version], obj 71 end 72 73 obj 74 end