I am working on a rails 3 app. I am trying to make a simple link_to
block, but I keep getting a routing error. I am not used to rails 3 (only have used rails 4), and am wondering if I am just missing something dumb, or if this is a rails version thing.
Here are my routes
namespace :api do
resources :multiple_prospects, :only => [:update, :destroy] do
put :flag, :on => :member
put :mass_flagging, :on => :collection
put :mass_archived, :on => :collection
put :mass_updating, :on => :collection
end
end
the controller looks like this
class Api::MultipleProspects < ApiController
def update
end
def flag
end
def destroy
end
end
and here is the link_to that is resulting in the error: No route matches {:action=>"flag", :controller=>"api/multiple_prospects"}
<%= link_to flag_api_multiple_prospect_path do %>
<button><i class="icon icon-flag prospect-flag"></i></button>
<% end %>
and the output of rake routes CONTROLLER=api/multiple_prospects
is
flag_api_multiple_prospect PUT /api/multiple_prospects/:id/flag(.:format) api/multiple_prospects#flag
mass_flagging_api_multiple_prospects PUT /api/multiple_prospects/mass_flagging(.:format) api/multiple_prospects#mass_flagging
mass_archived_api_multiple_prospects PUT /api/multiple_prospects/mass_archived(.:format) api/multiple_prospects#mass_archived
mass_updating_api_multiple_prospects PUT /api/multiple_prospects/mass_updating(.:format) api/multiple_prospects#mass_updating
api_multiple_prospect PUT /api/multiple_prospects/:id(.:format) api/multiple_prospects#update
DELETE /api/multiple_prospects/:id(.:format) api/multiple_prospects#destroy
does anyone see something wrong I am doing? I have done something like this in rails 4 and it worked fine. I am not sure what I am doing wrong here that is causing this error. Any help would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire