Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails RoR:搜掠搜索不起作用_Ruby On Rails_Ransack - Fatal编程技术网

Ruby on rails RoR:搜掠搜索不起作用

Ruby on rails RoR:搜掠搜索不起作用,ruby-on-rails,ransack,Ruby On Rails,Ransack,我正试图让搜救系统运行,但由于某种原因,它不起作用 tweets#index.html.erb <%= render partial: 'tweets_index' %> <%= search_form_for @q, url: tweets_path do |f| %> blah blah <% end %> <% @users.each do |user| %> <tr> <td>....<

我正试图让搜救系统运行,但由于某种原因,它不起作用

tweets#index.html.erb

<%= render partial: 'tweets_index' %>
<%= search_form_for @q, url: tweets_path do |f| %>
blah blah
<% end %>

<% @users.each do |user| %>
      <tr>
    <td>....</td>
<% end %>
<%= render partial: 'users/search_index' %>
应用程序控制器

  def set_search
    @q = User.ransack(params[:q])
    @search = Tweet.ransack(params[:search])
  end
输出

Started GET "/tweets?q%5Bcontent_cont%5D=hello&commit=Search" for ::1 at 2020-08-28 12:18:21 +0100
Processing by TweetsController#index as HTML
  Parameters: {"q"=>{"content_cont"=>"hello"}, "commit"=>"Search"}
但什么也没发生,页面只是用相同的推文列表刷新。我的其他用户搜索是否会干扰此搜索(我在参数中看到q)?这个搜索不是在桌子上,我不知道这是否有什么关系?如果需要,可以提供更多详细信息。 泰

编辑

我的用户搜索工作如下

users/\u search\u index.html.erb

<%= render partial: 'tweets_index' %>
<%= search_form_for @q, url: tweets_path do |f| %>
blah blah
<% end %>

<% @users.each do |user| %>
      <tr>
    <td>....</td>
<% end %>
<%= render partial: 'users/search_index' %>

废话
....
Index.html.erb

<%= render partial: 'tweets_index' %>
<%= search_form_for @q, url: tweets_path do |f| %>
blah blah
<% end %>

<% @users.each do |user| %>
      <tr>
    <td>....</td>
<% end %>
<%= render partial: 'users/search_index' %>