0

How can you input multiple values for the one field into a Ruby functional test, much like a multiselect box? Code below that I thought would work, doesn't.

post :create, :post => { :multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] }

1 Answer 1

1

unless you were really trying to post "post[multiselect1][]" and "post[multiselect2][]" you should try this:

post :create, {:multiselect1 => ['value1', 'value2'] , :multiselect2 => ['value3', 'value4'] }

this will submit "multiselect1[]" and "multiselect2[]"

let me know if my assumption was wrong

cheers!

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Addy! Your assumptions are correct. But it seems that the multiselects built with the collection_select() form helper actually send posts off in the format multiselect1[another_value][post_value_here]. Is there any way to emulate this in a functional test input?
Thats correct. what is the model that you are trying to use? is the model name "Post"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.