I'm working on Ruby on rails 2.3.4 and I'm trying to develop a Sort feature on my website's search page(its url is /anuncios/buscar).
What I tried is to create a "map" on routes file:
map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance'
Then, I wrote this on the view:
<%= link_to 'MÁS RELEVANTES', search_filter_relevance(@announcements) %>
And finally, I created a method in the controller, as is specified on the routes' line:
def search_filer_relevance
raise params.inspect
end
First of all, as I'm sorting search results, I'd like to keep them in their public variable called @announcements. Please help me do this.
An the other thing is that when I click the link I get an error due its trying to access the Show action instead of search_filter_relevance as specified in routes. Why is this happening?