Commit a5db20d0
Changed files (2)
app
controllers
api
config
app/controllers/api/v1/cakes_controller.rb
@@ -35,6 +35,11 @@ module Api
respond_with(@cake = cake)
end
+ def destroy
+ current_user.creations.find(params[:id]).destroy!
+ render nothing: true
+ end
+
private
def cake_params
config/routes.rb
@@ -46,7 +46,7 @@ Cake::Application.routes.draw do
namespace :api, :defaults => { :format => 'json' } do
namespace :v1 do
- resources :cakes, only: [:index, :show, :create, :update] do
+ resources :cakes, only: [:index, :show, :create, :update, :destroy] do
resources :photos, only: [:index, :show, :create]
end
resources :categories, only: [:index]