我的应用程序中有一个标签,如下所示。
<div class = "form-group">
<%= form.label :shipping_destination,:class =>'col-sm-2'%>
</div>
我想设置一个来自Spree的动态值,而不是显示&#34; Shipping Destination&#34;,
<%=@order.shipping_address.country.name %>
如何将此值作为值传递给标签?
答案 0 :(得分:0)
<div class = "form-group">
<%= form.label :shipping_destination,@order.shipping_address.country.name,:class =>'col-sm-2'%>
</div>
修改强>
只需将字符串作为第二个参数传递给标签表单助手,即可自定义标签名称
<%= form.label :shipping_destination,"My Custom Label",:class =>'col-sm-2'%>