模板缺少Ruby on Rails

时间:2018-04-16 13:47:28

标签: ruby-on-rails ruby

我收到以下错误:

Template is missing

Missing template clients/search, application/search with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}.

我的视图文件夹中有一个_search.html.erb文件,但是当我按下客户端页面上的搜索按钮时,我不确定为什么它不起作用。

index.html.erb

<div id="client-search">
    <%= render(:partial=>'/search',:locals=>
               { :my_path => "/clients/search" })%>
</div>

_search.html.erb (放置在views文件夹中的文件)

<%= form_tag my_path do %>
    <h6>Search Customer</h6>
    <%= text_field_tag :search_string %>
    <%= submit_tag 'Search' %>
<% end %>

clients_controller.rb

  def search
    @clients = Client.simple_search(params[:search_string])
    render :actions => "index"
  end

有人可以帮助我,为什么我无法搜索任何客户?

1 个答案:

答案 0 :(得分:0)

由于Yule建议render :actions应该是单数的:

render :action => "index"