order_products_url
expects a parameter to be passed - either the order id, or the order object itself. Without this, it won't work properly. So using your code above:
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(@order) } format.xml { head :ok } endend
As a side note, you can shorten your routes a little:
resources :orders do resources :productsend
Specifying the controller is redundant when it's named as Rails expects. I hope this helps!
UPDATE: I've added a link to my article about routing in Rails 3, with downloadable code samples. I updated it with a paragraph that explains named routes, in the "Things You Should Know" section: