link_to for calling an action, instead of a button_to
- by Brian Roisentul
I'd like to call an action with a link_to button without being redirected to another page(I don't want ajax). For you to have an idea, I'm trying to accomplish a sort "link button" in a search page. So, when the link is clicked, the page should be refreshed showing the list ordered as I tell it in the action.
If I do the following in my view, it will ask me for a template called as the action, and I don't want it:
<%= link_to 'MÁS RELEVANTES', search_filter_relevance_path %>
My routes file looks like this:
map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance'
And my controller looks like this(I haven't developed the functionality yet):
def search_filter_relevance
end
Any help on this will be appreciated.