1

I am receiving a error on the line = select_tag :ethnicity, ['Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other'], prompt: 'ethnicity/race' that reads no implicit conversion of Array into String

Can someone assist?

index.html.slim:

  = form_tag searches_path, method: :get do
          .select4
            .col.col7 style='margin-left: 10px;width:233px;'
              = select_tag :ethnicity, ['Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other'], prompt: 'ethnicity/race'
0

2 Answers 2

2

Try this

= select_tag :ethnicity, options_for_select(['Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other'])

Note the options_for_select method

Source

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

Comments

2

select_tag(name, option_tags = nil, options = {}) public

Helpers::FormOptions can be used to create common select boxes such as countries, time zones, > or associated records. option_tags is a string containing the option tags for the select box.

http://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag

The second parameter should be a HTML string - not an array. You can use options_for_select to generate option tags from an array.

Comments

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.