国家选择Rails 4中的Gem(gem'i18n_country_select','1.1.4')

时间:2014-12-17 00:11:14

标签: ruby-on-rails ruby ruby-on-rails-4 gem

我使用了gem' i18n_country_select',' 1.1.4'对于国家选择,但它没有工作,我已经按照他们的简短文档。 https://github.com/onomojo/i18n_country_select ..

或者如果你有建议的宝石类似国家选择可能对我有帮助。

这是我的表格

<%= form_for([@user,@user_profile]) do |f|  %>

<div>
    <%= f.label :firstname, "Firstname" %>
    <%= f.text_field :firstname %>
</div>

<div>
    <%= f.label :lastname, "Lastname" %>
    <%= f.text_field :lastname %>
</div>

<div>
    <%= f.label :birthdate, "Birthdate" %>
    <%= f.date_select :birthdate, :start_year => Date.current.year, :end_year => 1920 %>
</div>

<div>
    <%= f.label :street_address, "Street" %>
    <%= f.text_field :street_address %>
</div>

<div>
    <%= f.label :city_address, "City" %>
    <%= f.text_field :city_address %>
</div>

<div>
    <%= f.label :country, "Country" %>
    <%= f.country_code_select(:user_profile, :country) %>
</div>

<div>
    <%= f.submit "Save Profile" %>
</div>

<% end %>

谢谢!

1 个答案:

答案 0 :(得分:0)

我认为错误就在这一行:

<%= f.country_code_select(:user_profile, :country) %>

必须是:

<%= f.country_select(:user_profile, :country) %>

请测试一下,如果它正常工作,请告诉我们

相关问题