我已经为选择框标签应用了本地化,如下所示。标签选项不在rails_select中以rails形式工作。如何更改代码以获取标签
更新
= simple_form_for @product do |f|
= error_notification f
.form-inputs
.row
.span5
= f.input :name, :input_html => {:maxlength => 100}
.span5
- unless @product.company.nil?
= f.input :company_id, :as => :hidden, :input_html => { :value => @product.company.id}
- else
= f.association :company, :prompt => "Select Company"
.row
.span10
%div#product_existence_message
- unless @product.company.nil?
= f.collection_select :product_type_id, ProductType.all,:id, :name, {:prompt => 'Select Product Type', :label => :label => t('forms.products.label.name'), :selected =>@product.product_type_id }
答案 0 :(得分:0)
文件:en.yml
en:
activerecord:
attributes:
product:
product_type: 'Product Type translation here'
文件:template.html.erb
<%= label(:product, product_type) %>
# => <label for="product_product_type">Product Type translation here</label>