summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-01-27 21:56:41 -0700
committermo khan <mo@mokhan.ca>2015-01-27 21:56:41 -0700
commita03ff0d376e2ecc5006bd67a573c19d035b0c3f0 (patch)
treeef64e038e7bc7428317d86e46c14e830a561be99 /app/controllers
parent63a52f3552b940a8222a0ad2cbc647bd92175daf (diff)
collapse create cake command.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/cakes_controller.rb14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/api/v1/cakes_controller.rb b/app/controllers/api/v1/cakes_controller.rb
index 2c09fae0..9fb422c4 100644
--- a/app/controllers/api/v1/cakes_controller.rb
+++ b/app/controllers/api/v1/cakes_controller.rb
@@ -10,15 +10,11 @@ module Api
end
def create
- CreateCakeCommand.new(self).run(cake_params, params[:cake][:tags])
- end
-
- def create_cake_succeeded(cake)
- @cake = cake
- end
-
- def create_cake_failed(cake)
- @cake = cake
+ category = Category.find(cake_params[:category_id])
+ @cake = current_user.create_cake(name: cake_params[:name], category: category)
+ if @cake.save
+ PublishToTwitterJob.set(wait_until: 1.hour.from_now).perform_later(@cake)
+ end
end
def update