Country expected, got String error

后端 未结 6 1209
栀梦
栀梦 2020-12-10 16:38

I have 2 models \"Country\" and \"League\", Country has many Leagues and League belongs to Country. When adding a league, I have a listbox with countries and when the form i

6条回答
  •  执念已碎
    2020-12-10 17:15

    for others who met the same problem:

    this error is caused when you have two fields in your form like:

    video: 'some string'
    video['url']:  'some url'
    

    then rails will crash with the error: expected Hash (got String) for param

    the solution is quite simple: change 'video' to something else. e.g.:

    video_origin_url: 'some string'
    video['url']: 'some url'
    

提交回复
热议问题