简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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