TypeError (Hash expected (received string) for param `content '

I am currently trying to add widgEditor to a ruby ​​on rails form, but whenever I click 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> 

Does anyone have any experience with this problem?

+6
source share
2 answers

It seems that he gave too many parameters from what I can say. By adding $ (this.theExtraInput) .remove (); to the pureSource function from widgEditor now it only sends a content field and works fine.

0
source

for others who are facing the same problem:

this error occurs when you have two fields in your form:

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

then the rails will fail with an error: Hash is expected (received string) for the parameter

The solution is quite simple: change the "video" to something else. eg:

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

see also this question: fooobar.com/questions/667379 / ...

+18
source

Source: https://habr.com/ru/post/899699/


All Articles