Rails仅在控制台中形成重定向渲染

时间:2017-09-09 07:43:39

标签: ruby-on-rails sqlite

我正在使用Rails 5.1并希望在我的网站中包含一个搜索字段,因此我添加了一个带有“form_with”的小表单。在我的服务器日志中声称所有内容都按预期呈现,但页面/产品仍无法加载。而是页面不响应“提交”:

 Rendered products/index.html.erb within layouts/application (24.5ms)

这是我的表格:

<%= form_with(url: products_path, method: 'get') do |form| %>
  <%= form.label :q, 'Search for:' %>
  <%= form.text_field :q, id: 'q', value: params[:q] %>
  <%= form.submit 'Search' %>
<% end %>

这是我完整的服务器日志,以防它有所帮助。

Started GET "/products?utf8=%E2%9C%93&q=x&commit=Search" for 127.0.0.1 at 2017-09-09 09:39:37 +0200
Processing by ProductsController#index as JS
  Parameters: {"utf8"=>"✓", "q"=>"x", "commit"=>"Search"}
  Rendering products/index.html.erb within layouts/application
  Product Load (0.7ms)  SELECT "products".* FROM "products"
  Rendered collection of products/_product.html.erb [5 times] (2.8ms)
  Rendered products/index.html.erb within layouts/application (24.5ms)
Completed 200 OK in 98ms (Views: 78.3ms | ActiveRecord: 0.7ms)

搜索字段位于与products / index.html.erb不同的页面上。但是我的服务器说它是“渲染”的。为什么我没有重定向到它呢?

0 个答案:

没有答案