0

Ruby Grape を使用して DB に複数の行を投稿する方法。たとえば、CURL でテストする場合、これは正常に機能しています

curl -H "Content-Type: application/json" -X POST \
     -d '{"name": "test", "age": "22"}' http://localhost:3000/students

しかし、これは機能していません

curl -H "Content-Type: application/json" -X POST \
     -d '[{"name": "test", "age": "22"}, {"name": "someone", "age": "32" }]' \
     http://localhost:3000/students

これは私のブドウのAPIコードです

post do
      student = Student.new
      student.name = params[:name]
      student.age = params[:age]
      student.save!
end
4

1 に答える 1