Running Rails 3.2.11, I have a regular controller “LbuController” which is basically an enhanced scaffold, enhanced by 4 additional GET methods used for AJAX requests.
resources :lbus do
get 'add_offering'
get 'remove_offering'
get 'add_offering_element'
get 'remove_offering_element'
end
running rake routes gives me the following routes
lbu_add_offering GET /lbus/:lbu_id/add_offering(.:format) lbus#add_offering
lbu_remove_offering GET /lbus/:lbu_id/remove_offering(.:format) lbus#remove_offering
lbu_add_offering_element GET /lbus/:lbu_id/add_offering_element(.:format) lbus#add_offering_element
lbu_remove_offering_element GET /lbus/:lbu_id/remove_offering_element(.:format) lbus#remove_offering_element
lbus GET /lbus(.:format) lbus#index
POST /lbus(.:format) lbus#create
new_lbu GET /lbus/new(.:format) lbus#new
edit_lbu GET /lbus/:id/edit(.:format) lbus#edit
lbu GET /lbus/:id(.:format) lbus#show
PUT /lbus/:id(.:format) lbus#update
DELETE /lbus/:id(.:format) lbus#destroy
which seem exactly to be what I intended.
But following a link to http://localhost:3000/lbus/new created with link_to "new", new_lbu_path gives me the following error:
No route matches {:action=>"add_offering", :lbu_id=>nil, :offering_id=>1, :controller=>"lbus"}
which makes absolutely no sense for me.
Anybody got any ideas what’s happening here and what’s going wrong?
Thanks in advance!
On the ‘new’ view you must have used a lbu_add_offering path.
That path seems to be incorrect. The error refers to that :action=> “add_offering”.