开发者

Rails: many-to-one display on form via dynamically added input text boxes

I have a form in rails that allows the user to create a new object (call it a search).

This object has_many excluded_phrases.

What I would like is the ability to display one text box per excluded phrase added.

The form will start out with only a single text box, allowing the user to add one excluded phrase. If they want to add开发者_运维问答 more, there will be button labeled "+" that will dynamically add one more text box, and allow the user to add as many more items as he wants.

On form submit, this should populate the db with the user search, and create all the required phrases that are linked to that user search.

Help?


All inspiration needed is there:

http://railscasts.com/episodes/197-nested-model-form-part-2


This popular rails plugin does exactly what you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜