Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError (expected Hash (got String) for param `content'

I'm currently trying to add widgEditor to a form in ruby on rails however whenever I hit submit I get the following error:

TypeError (expected Hash (got String) for param `content'

The form code is as follows:

<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content,  :cols => "20", :rows=>"4", :class=>"widgEditor" %>
</div>
<div class="actions">
    <%= f.submit %>
 </div>

has anyone got any experience with this issue?

like image 496
Jeff_Hd Avatar asked Oct 20 '11 12:10

Jeff_Hd


1 Answers

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'

see this question also: https://stackoverflow.com/a/19246703/445908

like image 122
Siwei Avatar answered Oct 22 '22 07:10

Siwei