# URL formatting

**URL:** <https://www.ruby-forum.com/t/url-formatting/164630>\
**Category:** Rails\
**Created:** [April 3, 2009, 1:04pm UTC](https://www.ruby-forum.com/t/url-formatting/164630 "2009-04-03T13:04:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![palani](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed655f/32.png) [@palani](https://www.ruby-forum.com/u/palani)\
**Post date:** [April 3, 2009, 1:04pm UTC](https://www.ruby-forum.com/t/url-formatting/164630/1 "2009-04-03T13:04:11Z")

</div>

Hi,  
The problem i am facing is as follows:

```
   I want to generate the URL as follows

```

[http://localhost:3000/developments/find/india](http://localhost:3000/developments/find/india)

As of now MY URL is :

```
     http://localhost:3000/developments/find?search[address]=India.

```

The above URL is framed from JQuery by selecting the select box value.

The JQuery i used:

```
def select_filter_by_city_js
<<-END
  Event.observe($('filter_by_country'), 'change', function(e) {
    window.document.location = '#{search_developments_url}' +

```

?search[address]=’ + e.element().getValue();  
});  
END  
end

In my routing file(routes.rb) : i defined for search\_developments\_ur

map.search\_developments ‘/developments/find/’,:controller=\>  
‘developments’,:action=\>‘search’

In my controller : I get the value like

def search

```
location.heading = :search

show_results = params.has_key?(:search)

```

@title = 'Find Developments ’ + params[:search].to\_s  
@search = Development::Search.new(params[:search])  
@developments = show\_results ? @search.run(params[:page]) :  
Development.find(:all)

```
respond_to do |format|
  format.html { render :action => (show_results ? 'index' :

```

‘search’) }  
format.xml { render :xml =\> @developments }  
end  
end

```
I guess i need to work with routes.rb. I tried so many combinations

```

but no luck . can any one please advise me. what i miss here . Thanks.
