如果在输入语句上选择

迷你约翰

以我的形式我有

<!-- Allow Custom Orders Field -->
<div class="control-group">
  <label class="control-label">Allow Custom Orders?</label>
  <div class="controls">
    <%= f.select :allow_custom_orders, [["Yes", 1], ["No", 2]],
                 label: false %>

  </div>
</div>

在我的表演中,我想检查是否选择了"Yes""No",然后显示我的按钮。

<% if @shop.allow_custom_orders = "1"  %>
  <div>
    <small>Need a custom order?</small>
    <%= link_to "Request Custom Order", "#",
                class: "btn btn-small btn-embossed btn-block btn-info" %>
  </div>
  <% end %>

但这似乎不起作用,有什么建议吗?

我是Rails的新手,所以请多多包涵:)

迷你约翰

好的发现了:)实际上非常简单

<% unless @shop.allow_custom_orders == 2  %>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章