When you delete, you may forget that it is an embedded resource. You know which book you are talking about, so you can simply delete it directly.
Routes
resources :users do
resources :books, :only => [:new, :create]
end
resources :books, :only => :destroy
Book controller:
def destroy
@book = Book.find(params[:id])
@book.destroy
redirect_to current_user
end
View:
<%= link_to "Delete", book_path(book), :method => :delete %>
source
share