Rails inserting multiple records for single model

前端 未结 2 398
半阙折子戏
半阙折子戏 2021-01-23 06:03

How shall I set the form fields to be able to insert multiple rows in the database for a single model.

I am updating a div with another link and cannot use the form hel

2条回答
  •  逝去的感伤
    2021-01-23 06:38

    posts = Array.new
    posts << {:title => "title 1"}
    posts << {:title => "title 2"}
    Post.create(posts)
    

提交回复
热议问题