Ruby on rails 轨道&x2013;AJAX搜索、排序、使用Ransack和Kaminari分页

Ruby on rails 轨道&x2013;AJAX搜索、排序、使用Ransack和Kaminari分页,ruby-on-rails,ruby,ajax,ruby-on-rails-4,ransack,Ruby On Rails,Ruby,Ajax,Ruby On Rails 4,Ransack,我一直在学习本教程,效果很好,问题是在搜索字段时向我发送了以下错误: Started GET "/catbancos?utf8=%E2%9C%93&q%5BClave_cont%5D=qqq&q%5BDescripcion_cont%5D=&commit=Search" for 127.0.0.1 at 2017-02-12 02:23:59 -0400 Processing by CatbancosController#index as JS Parameters:

我一直在学习本教程,效果很好,问题是在搜索字段时向我发送了以下错误:

Started GET "/catbancos?utf8=%E2%9C%93&q%5BClave_cont%5D=qqq&q%5BDescripcion_cont%5D=&commit=Search" for 127.0.0.1 at 2017-02-12 02:23:59 -0400
Processing by CatbancosController#index as JS
  Parameters: {"utf8"=>"✓", "q"=>{"Clave_cont"=>"qqq", "Descripcion_cont"=>""}, "commit"=>"Search"}
Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.0ms)

RuntimeError (No table named catbancos exists.):
  app/controllers/catbancos_controller.rb:8:in `index'
该表称为“catbancos”,单数为“catbanco”

这是我的控制器索引:

 def index
    @search = Catbanco.search(search_params)
    @search.sorts = 'Clave' if @search.sorts.empty?
    @catbanco = @search.result().page(params[:page])
  end
这是我的index.html.erb

  <% provide(:title, Catbanco.model_name.human.pluralize) %>
  <h1><%= Catbanco.model_name.human.pluralize %></h1>
  <div class="row">
    <%= link_to t("basic.create.type", type: Catbanco.model_name.human ), new_catbanco_path, class: "btn btn-success pull-right" %>
  </div>

  <div id="catbancos"><%= render 'catbancos' %></div>

这是我的部分catbancos:

<table class="table table-striped table-bordered table-condensed table-hover">
<thead>

  <%= search_form_for @search, :remote=>"true", url: catbancos_path, :method => :get do |f| %>
      <tr>
        <th class="component_name_header_col">
          <%= sort_link @search, :Clave, "Clave","catbanco", {}, { :remote => true, :method => :get } %>
        </th>
        <th class="component_component_definition_name_header_col">
          <%= sort_link @search, :Descripcion,"Descripcion","catbanco", {}, { :remote => true, :method => :get } %>
        </th>

        <th class="action_col"><%= t("basic.action") %></th>
      </tr>
      <tr>
        <th><%= f.text_field :Clave_cont %></th>
        <th><%= f.text_field :Descripcion_cont %></th>
        <th>  <%= f.submit "Search" %></th>
  </tr>

</thead>
<tbody>
  <% @catbanco.each do |catbanco| %>
<tr>
<td class="component_name_body_col"><%= catbanco.try(:Clave) %></td>
<td class="component_component_definition_body_col"><%= catbanco.try(:Descripcion) %></td>
<td>
<div class="btn-group"><a class="btn dropdown-toggle btn-primary action-btn" href="#" data-toggle="dropdown">
 <%= t('basic.action') %>

 </a>
<ul class="dropdown-menu">
    <li><%= link_to t('basic.show.simple'), catbanco %></li>
    <li><%= link_to t('basic.edit.simple'), edit_catbanco_path(catbanco) %></li>
    <li><%= link_to t('basic.destroy.simple'), catbanco, method: :delete, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
<!-- button group --></td>
</tr><% end %>
</tbody>
</table>
<%= paginate @catbanco %>
<% end %>

“true”,url:catbancos|u path,:method=>:get do|f|%>
true,:method=>:get}%>
true,:method=>:get}%>

尝试运行
Catbanco。首先在rails控制台中运行
。如果出现同样的错误,那么您需要检查您的数据库是否有catbancos表。@AbhishekKumar感谢您的回复,好的,我试图将Catbanco放在rails控制台中,并显示Catbanco的第一条记录