简体   繁体   English

搜索字段似乎未显示在视图中

[英]Search field doesn't seem to appear in view

I have the following code in my view file 我的视图文件中包含以下代码

<%= form_tag search_path, class: "form-inline", method: :get do %>
<div class="input-group input-group-lg">
<% if params[:query].present? %>
 <div class="input-group-btn">
   <%= link_to "clear", search_path, class: "btn btn-default" %></div>
<%= text_field_tag :query, params[:query], id: "univ_search", autocomplete: "on"%>
<div class="input-group-btn">
 <%= submit_tag "Search", class: "btn btn-primary"%>
  </div>
  </div>
<%end%>
 <%end%>

However, it doesn't show any text field or buttons in the browser. 但是,它在浏览器中不显示任何文本字段或按钮。 Can someone suggest a way to resolve this? 有人可以提出解决此问题的方法吗?

Looks like the condition 看起来像情况

<% if params[:query].present? %> 

is preventing the view. 正在阻止视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM