简体   繁体   中英

Template is missing Ruby on Rails

I am getting the following error:

Template is missing

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

I've got a _search.html.erb file in my views folder but I'm not sure why its not working when I press the search button on my clients page.

index.html.erb

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

_search.html.erb (file placed in views folder)

<%= 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

Any chance someone could help me as to why I can't search for any clients?

正如Yule所建议的render :actions应该是单数形式:

render :action => "index"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM