rails/rails — Issue #3580: Framework routes to wrong controller methods
Author: sbluen
Created: 2011-11-09 06:52:59+00:00
State: open

The :ctrl controller was generated through the command "rails generate controller ctrl".

With the line
resources :ctrl, :path_names => { :create => '/add_friend'}
in the routes.rb file, the link code
<%= link_to 'link text', {controller: 'ctrl', :other_id => 5}%>
should, when clicked, invoke a call to the :create method of the :ctrl controller with params[:other_id] equal to 5. If that is not implementable, the framework should at least give a warning. It does not. Instead, without a warning, the link code invokes the :index method of the same controller with the same params.

This is either a bug or a very frustrating lack of a feature.