ruby
1class Api::UsersController < ApplicationController 2 3 def edit 4 user = User.find(params[:id]) 5 end 6 7 def update 8 user = User.find(params[:id]) 9 if user.update(user_params) 10 Hint.destroy(params[:id]) 11 Hint2.destroy(params[:id]) 12 render json: user 13 else 14 @msg = やり直し 15 render json: @msg 16 end 17 end 18 19 20 21 private 22 def user_params 23 params.require(:user).permit(:like_id) 24 end 25end
updateが完了するとHint, Hint2モデルのレコードの中身が消えるようにしたいです。
しかしpostmanを使うとActionController::ParameterMissing (param is missing or the value is empty: user):
と出ます。どのように改善すればいいでしょうか。ご教授願います。
あなたの回答
tips
プレビュー