Ruby on Rails: Multiple Same Input Fields in Same Form

浪尽此生 提交于 2019-12-06 04:58:04

It's failing because what you've got above evaluates to thee html field with the same name/id and the browser will only post the value for one of them. If they are different fields, then you need to give them unique names/ids or you need to create them as an array eg:

  <%= f.text_field_tag 'content_array[]' %>

or, if you want these to be a set of posts - you'll need to add multiple sub-forms (one for each post) using a custom form.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!