我制作一个select_tag来选择值:
#index
<%= form_tag com_port_setting_write_path do %>
<%= select_tag "dropdown_cases[]", options_for_select([ ["6 Bottles", 1], ["12 Bottles", 2], ["18 Bottles", 3], ["24 Bottles", 4], ["30 Bottles", 5], ["36 Bottles", 6], ["42 Bottles", 7]]) %>
<%= submit_tag "Setting",:class => "btn btn-primary offset4" %>
<%end%>
<%end%>
#controller
def index
end
def com_port_setting_write
params["dropdown_cases"].each do |cases|
@this_is_the_dropdown_value = cases.to_i
puts @this_is_the_dropdown_value
end
render :com_port_setting
end
它工作正常但我想更改它以从表格中的选择单元格获取值,我该怎么做
编辑:我想创建一个表并从select cell获取值,我不知道该怎么做