-3

I want to know how I can make a with multiple select in ruby on rails.

for example:

I have this

<% b.label :question %>

<select multiple class="question">
  <option value="Dog">Dog</option>
  <option value="cat bad">Cat</option>
  <option value="Rabbit">Rabbit</option>
</select>

the idea is like to create a field but I don't want the user write the answer, only a I want they choose the answer or multiple answer if the want.

Thank You so much.

confix
  • 9
  • 4
  • You can see something like you want to do please have a look at [here ](https://stackoverflow.com/a/4864801/5922155) – Asmita Aug 24 '17 at 18:09
  • You can see something like you want to do please have a look at [here](http://stackoverflow.com/a/4864801/5922155) – Asmita Aug 24 '17 at 18:12

1 Answers1

0

You can use the select_tag method (https://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag). So you can do something like:

select_tag "question", options_for_select([["Dog", "Dog"], ["cat bad", "Cat"], ["Rabbit", "Rabbit"]])
Ronan Lopes
  • 3,320
  • 4
  • 25
  • 51