It generates views with array style form field names. For example, if your model name is "widget" and it has an attribute of "column1", the form name generated in views will be name="widget[column1]". It may not be immediately clear how to reference this field using params in the controller.
The answer is to reference it as a hash of hashes. A simple name="field" is referenced in the controller as params[:field]. The scaffold generated field in the above example would be referenced as
params[:widget][:column1]
.
No comments:
Post a Comment