我想在我的Rails Web表单中包含国家选择选择框。 Ruby on Rails怎么可能?我的表单是这样的
Ruby on Rails Web表单中的国家选择
<%= form_for :User, :url => {:action => :create } do |f| %>
<div class="field">
<%= f.label :select_countries %><br />
<%= f.select(:countries, country_list) %>
</div>
<%= f.submit "Create" %>
<% end %>
我可以用什么来代替country_list?
[i18n country select](https://github.com/onomojo/i18n_country_select)允许你做同样的事情,但是使用标准的双字母代码而不是国家的具体英文单词:这个例子有一个字段“country”包含代码,并且选择框在顶部添加首选的国家/地区字段,以本地化的形式说“瑞典”。瑞典的关键是“SE”。 '= f.country_code_select(:country,[[I18n.t(:SE,:scope =>:countries),'SE']])' – olleolleolle 2013-06-03 14:19:29