0

I have a search box at the top of my view as follows

<%= form_tag clients_path(@client), :method => 'get' do %>
<h2> Search for Workflows </h2>
<p>
  <%= text_field_tag :search, params[:search] %>
  <%= submit_tag "Search", :name => nil %>
</p>
<% end %>

This is calling my show controller

def show
@client = Client.find(params[:id])
@workflows_raw = Workflow.where(:client_id => @client.id)

unless params[:search].blank?
  @workflows_raw = @workflows_raw.search(params[:search])      
end

@workflows = @workflows_raw.sort_by {|flow| flow.name}

respond_to do |format|
  format.html
  format.js
end

end

What I am getting back is this:

http://localhost:3000/clients.4?utf8=%E2%9C%93&search=Add

What I WANT to get back is this: (Note the slash)

http://localhost:3000/clients/4?utf8=%E2%9C%93&search=Add

What am I missing?

JasonPerr
  • 339
  • 3
  • 16

1 Answers1

1

You should be using client_path(@client) in your form_tag line (note the singular client_path vs the plural clients_path)

Dylan Markow
  • 123,080
  • 26
  • 284
  • 201