【发布时间】:2023-03-06 07:05:01
【问题描述】:
我对 ROR 不是很有经验,它是一种在 rails 应用程序中创建运输选项的简洁方法吗?
刚刚在我的 orders_form 中添加了这段代码:
<% if @order.subtotal >= 30 %>
(free shipping)
<%= f.radio_button(:shipping, "0.00", :checked => "checked", class: "hidden_field") %><br/>
<% else %>
<p><strong>Shipping options :</strong></p>
<%= f.label 'economy' %>
<%= f.radio_button(:shipping, "3.00", :checked => "checked") %><br/>
<%= f.label 'fast' %>
<%= f.radio_button(:shipping, "5.00") %>
<% end %>
对我来说似乎太简单了。
【问题讨论】:
标签: ruby-on-rails ruby form-helpers