How to generate parameters similar to a form

hi guys,

i have a search form set up which points to my search controller.
When I hit “submit” in the form, it activates the perform_search
method in my search controller.
It works ok.

A typical GET request that is performed would look like this:

http://my-test-box.local:3000/search?search[category_id_equals]=8&search[sub_category_id_equals]=&
search[location_like]=&search[new_equals]=0&search[title_like]
=&commit=Search

Now, I would like to make a “hot list” in my index page which is
basically links to “hot” items.

I am using the link_to helper but i can’t seem to generate parameters
similar to what it is like from a form.
My perform_search method has been coded to take search parameters
strictly from “params[:search]”.

In short, I need to be able to generate a url with parameters that
start with “[search]” followed by the attribute name and query value.

Something like:
http://my-test-box.local:3000/search?search[item_id_equals]=8
.

How do I go about doing that?

thanks :slight_smile:

search[category_id_equals]=8&search[sub_category_id_equals]=&

In short, I need to be able to generate a url with parameters that
start with “[search]” followed by the attribute name and query value.

Something like: http://my-test-box.local:3000/search?
search[item_id_equals]=8
.

How do I go about doing that?

When I do this in my view…

<%= link_to ‘test’, root_path(:search => {:one => 1, :two => 2}) %>

I get this in my development.log…

Processing HomeController#index (for 127.0.0.1 at 2010-02-02 14:14:42)
[GET]
Parameters: {“search”=>{“two”=>“2”, “one”=>“1”}, “action”=>“index”,
“controller”=>“home”}

hello, Philip,
Yes, it worked like a charm and it makes sense!

<%= link_to ‘test’, root_path(:search => {:one => 1, :two => 2}) %>

Perfect! thank you :slight_smile:

Call closed :slight_smile: