Jef*_*_Hd 7 javascript ruby-on-rails
我目前正在尝试将widgEditor添加到ruby on rails上的表单中,但每当我点击提交时,我都会收到以下错误:
TypeError (expected Hash (got String) for param `content'
Run Code Online (Sandbox Code Playgroud)
表格代码如下:
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content, :cols => "20", :rows=>"4", :class=>"widgEditor" %>
</div>
<div class="actions">
<%= f.submit %>
</div>
Run Code Online (Sandbox Code Playgroud)
有没有人有这个问题的经验?
Siw*_*申思维 21
对于遇到同样问题的其他人:
如果表单中有两个字段,则会导致此错误:
video: 'some string'
video['url']: 'some url'
Run Code Online (Sandbox Code Playgroud)
然后rails将崩溃并出现错误:预期Hash(获取字符串)为param
解决方案非常简单:将"视频"更改为其他内容.例如:
video_origin_url: 'some string'
video['url']: 'some url'
Run Code Online (Sandbox Code Playgroud)
也看到这个问题:https://stackoverflow.com/a/19246703/445908
据我所知,它提交了太多参数。通过添加 $(this.theExtraInput).remove(); 到 widgEditor 的 cleanSource 函数,它现在只提交内容字段并且工作正常。
| 归档时间: |
|
| 查看次数: |
5604 次 |
| 最近记录: |