I've implemented two boxes of research which correspond to two columns of my table. This solution works well:

In my index.html.erb:        <% form_tag search_intervenants_path, :method => :get do %>                <%= label_tag "code" %>                <%= text_field_tag "search[by_code]", params[:search].try(: , :code) %>                <%= label_tag "id" %>                <%= text_field_tag "search[by_id]", params[:search].try(:, :id) %>            <%= submit_tag "Search" %>          <% end %>

In my controller: def search        @intervenants =[:search])    render :index end

In my model: def      params.keys.inject(scoped({})) do |found, k|      params[k].blank? ? found : found.send(:"#{k}", params[k])        end end   scope :by_code, lambda {|name| where("intervenants.code LIKE ?", "%#{name}%")}   scope :by_id, lambda {|name| where(" LIKE ?", "%#{name}%")}

I would like to have an only search area, I tried but I didn't suceed in it... Who can help me? Thanks a lot !