Param is missing or the value is empty: ParameterMissing in ResultsController#update

前端 未结 2 658
礼貌的吻别
礼貌的吻别 2020-12-08 21:06

I have a Result that belongs to a Website. After I create the website I also create the result and redirect to its edit page. Here I want to add some more values.

M

2条回答
  •  抹茶落季
    2020-12-08 21:30

    I know, what you met. if you strong params is

    def result_params
      params.require(:result).permit(:data)
    end
    

    Your parameters should has the format like this

    Parameters: {"result"=>{"data"=>"string"}}
    

    and your parameters is just

    Parameters: {"data"=>"string"}
    

    so you should remove the "result"

提交回复
热议问题