I'm having issues with my destroy method on a nested source Product, that is tied to Orders.
After attempting to destroy an item, I'm redirecting users to my order_products_url. I receive the following routing error:
No route matches "/orders/1/products"
My destroy method looks like this:
def destroy
@product = Product.find(params[:id])
@order = Order.find(params[:order_id])
@product.destroy
respond_to do |format|
format.html { redirect_to(order_products_url) }
format.xml { head :ok }
end
end
And in routes.rb:
resources :orders do
resources :products, :controller => "products"
end
The reason why this is confusing me, is for my update method for products, I'm properly redirecting users to the order_products_url without issue. I don't understand why it works there but not here.
Thanks