Link redirects to "show" action instead of the indicated in routes.rb
- by Brian Roisentul
I'm working with Ruby on rails 2.3.4 and I'd like to have a link that executes an action when clicked.
The relevant part of the routes.rb file looks like this:
map.search_filter_relevance "/anuncios/buscar", :controller => 'announcements', :action => 'search_filter_relevance'
My view(it's the model's index page) looks like this:
<%= link_to 'MÁS RELEVANTES', search_filter_relevance_path %>
And my controller looks like this:
def search_filter_relevance
raise params.inspect
unless params[:announcements].nil? or params[:announcements].empty?
@announcements = params[:announcements].order_by_featured
end
end
The problem is that when I click the link I get an error due to some null value in the Show action! I'm not accessing that action at all...why is executing it?