Adding a path attribute to a form

Hi there,

I’m using a form tag to implement a search text_field.

<% form_tag catalogues_path(:select => params[:select]), :method

=> “get”, :class => “search_form” do %>

The problem is the catalogues_path which should consist a select
param. Unfortunately the select param doesn’t get handed over in the
upper example…

Any hint will be appreciated!

Thanks
Makrus

Makrus, as far as I understood your problem, you don’t have to
include :select in your path manually. Since your form uses :get
method, params will be sent via url automatically, you have only to
name them properly:

    <% form_tag catalogues_path, :method => :get do %>
      <%= text_field_tag :select, params[:select] %> <%=

submit_tag “Find”, :name => ‘’ %>
<% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs