summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-06-29 21:55:02 -0600
committermo khan <mo@mokhan.ca>2014-06-29 21:55:02 -0600
commitdfef69e6111a6a6003812bf78b1b4060dd3c0997 (patch)
treea3bd456db877844b5ad901473ec34df2e5addc07 /app/controllers/api
parent9921cc76c31068f4d31e5c0a0e58d4b11485cb2d (diff)
fix the edit cake page.
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/cakes_controller.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/api/v1/cakes_controller.rb b/app/controllers/api/v1/cakes_controller.rb
index 8757fd16..f33d2da0 100644
--- a/app/controllers/api/v1/cakes_controller.rb
+++ b/app/controllers/api/v1/cakes_controller.rb
@@ -12,7 +12,7 @@ module Api
end
def create
- CreateCakeCommand.new(self).run(cake_params, params[:cake][:cake_tags])
+ CreateCakeCommand.new(self).run(cake_params, params[:cake][:tags])
end
def create_cake_succeeded(cake)
@@ -24,13 +24,21 @@ module Api
end
def update
- raise params.inspect
+ UpdateCakeCommand.new(self).run(params[:id], params[:cake][:tags], cake_params)
+ end
+
+ def update_cake_succeeded(cake)
+ respond_with(@cake = cake)
+ end
+
+ def update_cake_failed(cake)
+ respond_with(@cake = cake)
end
private
def cake_params
- params.require(:cake).permit(:name, :story, :is_restricted, :watermark, :category_id)
+ params.require(:cake).permit(:name, :story, :is_restricted, :watermark, :category_id, :tags)
end
end
end