开发者

Translating label for references collection_select

i have form with one selectbox (collection_select) for references column. What is proper way to translate label for this widget? For all others a use default Model.human_attribute_name (my code, Translations for Active Record M开发者_运维百科odels)


If you use in your [language].yml file:

attributes:
  my_model:
    property: 'translatet property label'
    [...]

You can simply use the following in your view:

<%= form_for([...]) do |f| %>
  <div class="field">
    <%= f.label :property %><br />
    <%= f.collection_select [...] %>
  </div>
  [...]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜