我有以下bootstrap表单标记:
<%= bootstrap_form_tag(url: pins_path, method: "get") do |f| %>
<%= f.search_field :search, params[:search], placeholder: "Search restaurants" %>
<%= f.submit "Search", :name => nil %>
<% end %>
现在我收到错误消息:
wrong number of arguments (3 for 1..2)
有谁知道该怎么做?
答案 0 :(得分:1)
您的第二个参数必须是哈希值,因此您应该使用value
键将值传递给字段:
<%= f.search_field :search, value: params[:search], placeholder: "Search restaurants" %>