Open ACPK opened 9 years ago
It is actually being done like that, https://github.com/kurenn/market_place_api/blob/chapter7/app/controllers/api/v1/products_controller.rb
We need to send the user_id because of the nesting of resources, it is an issue more related to an interface from the outside...
What do you think?
In the spec, you have (example delete action):
delete :destroy, { user_id: @user.id, id: @product.id }
Using Devise_token_auth, I have refactored the above code to the snippit below as the access-token, client, uid, and expiration date are in the header.
delete :destroy, { id: @product.id }
And did you updated your routes file?
In Chapter 6, you set the user_id manually.
This should automatically be set using the current_user attribute in the controller.