Strong parameters require multiple

前端 未结 7 1620
广开言路
广开言路 2020-12-30 19:03

I\'m receiving a JSON package like:

{
  \"point_code\" : { \"guid\" : \"f6a0805a-3404-403c-8af3-bfddf9d334f2\" }
}

I would like to tell Rai

相关标签:
7条回答
  • 2020-12-30 20:03

    I had a similar need and what I did was

    def point_code_params
      params.require(:point_code).require(:guid) # for check require params
      params.require(:point_code).permit(:guid) # for using where hash needed
    end
    

    Example:

    def create
      @point_code = PointCode.new(point_code_params)
    end
    
    0 讨论(0)
提交回复
热议问题