Mel
Mel

Reputation: 2685

Simple Form Select with Rails Bootstrap

I realise most questions relating to using Simple Form (of this nature at least) go unanswered. I'm really struggling to understand the basics. The documentation is premised on too much knowledge for me to figure it out.

This is the overview from the simple form documentation that I'm trying to understand. A worked example would really help me to learn.

#attribute_name, #column, #html_classes, #input_html_classes, #input_html_options, #input_type, #options, #reflection

I'd really appreciate some help with using select options in Simple Form.

Below is the extract from the Simple Form overview.

f.input :age, collection: 18..60, prompt: "Select your age"

I'm trying to use that as an example (along with the country priorities shown in the Simple Form overview example) to make the options between the elements in my array work. Can anyone see what I've done wrong. My attempt below (and many others) have not worked. I'm stuck.

<div class="question-project">
  <%= f.input :expense_type, collection: [Incidental, Less than $500, More than $500 ], prompt: "Are the expenses:"%></div>

Thank you

Upvotes: 0

Views: 416

Answers (1)

Ahmed
Ahmed

Reputation: 819

The array needs to have strings, like so:

<%= f.input :expense_type, collection: ["Incidental", "Less than $500", "More than $500" ], prompt: "Are the expenses:"%></div>

Upvotes: 1

Related Questions