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[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.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---