Rails Strong Params - Unknown Range of Numbers

222 views Asked by At

I have a survey with many answers that I'm trying to pass through Strong Params. The problem is that surveys all have a different amount of answers (from 1..200).

Each answer is being passed to params like "answers" => {1: "Answer", 2: "Answer2", 4: "Answer4"}

How do I define this in strong params when I'm not sure how many, or which keys there will be?

1

There are 1 answers

0
Jackson Cunningham On

Found the answer:

Rails hashes with unknown keys and strong parameters

Basically don't use strong params unless you know which keys to expect