Ruby on rails RoR:搜掠搜索不起作用
我正试图让搜救系统运行,但由于某种原因,它不起作用 tweets#index.html.erbRuby 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>....<
<%= 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' %>