[英]TypeError: no implicit conversion of Array into String
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
我在线
= select_tag :ethnicity, ['Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other'], prompt: 'ethnicity/race'
收到错误= select_tag :ethnicity, ['Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other'], prompt: 'ethnicity/race'
,它no implicit conversion of Array into String
读取no implicit conversion of Array into String
Can someone assist? 有人可以协助吗?
index.html.slim: 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'
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.
Helpers :: FormOptions可用于创建常见的选择框,例如国家/地区,时区,>或相关记录。 option_tags is a string containing the option tags for the select box.
option_tags是一个字符串,其中包含选择框的选项标签。
http://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag
http://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag
The second parameter should be a HTML string - not an array. 第二个参数应该是HTML字符串-而不是数组。 You can use
options_for_select
to generate option tags from an array. 您可以使用
options_for_select
从数组生成选项标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.