I have to loop through an unknown set of attributes and build a edit form
and I am not understanding clearly the way form_for works, and the syntax required.
trying to do something like this:
- @thing.attributes.each_pair do |name, value|
= f.label name
= f.text_field value
while the label part works, the actual text_field does not
text_fieldshould be passed the name of the field rather than the current value so needs to beSee the example at the top of this page: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
Rails will pick up the current value of the field from the object that you’ve passed to
form_forso it doesn’t need to be one of the parameters totext_field.