[ACCEPTED]-expected Hash (got Array) for param 'samples'-ruby-on-rails-2

Accepted answer
Score: 18

for others who met the same problem:

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

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

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

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

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

I had the same problem, and just fixed it.

Check 4 the headers of your request. I mine I saw:


It 3 was the last two which caused the issue. In 2 my case I had to give this weight an ID 1 to get rid of the error.

Score: 0

I also got this error Invalid request parameters: expected Hash (got Array) for param 'cell'.

In my case, I misformed 4 the field name like

f.text_field :name, name: 'cell[name][]'

this was causing the 3 error. Now I did the following and the error 2 is gone:-

f.text_field :name, name: 'cell[][name]'

in this solution I was actually 1 trying to get data in array format.

More Related questions