Reputation: 4534
I have a bookmark controller which has the seven default RESTful actions.
I would like to have a form for batch bookmark creation.
It's going to have a textarea field where the user can enter URLs, one URL per line.
Upon submission, I would like to bulk-insert those URLs into the database.
Can someone help me to achieve this?
Upvotes: 2
Views: 563
Reputation: 107728
Hard to know without seeing your form, the field and the controller, but here we go.
params[:urls].split("\n").each do |url|
PostUrl.create(url: url)
end
Upvotes: 4