Forum: Ruby on Rails URL formatting

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
266f1a5c2a6e62a549bc2ae99ca4b1c2?d=identicon&s=25 Palani Kumar (palani)
on 2009-04-03 13:04
Hi,
      The problem i am facing is as follows:

       I want to generate the URL as follows
http://localhost:3000/developments/find/india

As of now MY URL is :

         http://localhost:3000/developments/find?search[add....
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.
This topic is locked and can not be replied to.