我想在搜索表单中使用国家/地区选择,并且想知道 contry_select_tag 不适用于 form_tag
我试过以下
<%= form_tag new_search_path :html => {:multipart => true} do %>
<%= text_field_tag :search_val%>
<%= country_select_tag :country,[],["Germany", "France", "Austria", "Switzerland", "Netherlands", "Spain", "USA", "Russia"]%>
<%= submit_tag "Search" %>
<%end%>
并收到以下错误消息
undefined method `country_select_tag' for #<#<Class:0xb6640828>:0xb5d06d5c>
更改country_select_tag
为country_select
我没有错误,但:country
参数params
保持为空
!ruby/hash:ActiveSupport::HashWithIndifferentAccess
utf8: ✓
authenticity_token: GbmhaZAuSA3s88pTz+ZQJ6mxqZ1nrTpgSlSf40vttUY=
search_val: Test
country:
commit: Search
html: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
multipart: 'true'
controller: searches
action: results
我需要使用法线select_tag
并用模型中的国家/地区填充它还是有其他解决方案