From c2e5237da57312fedc06b801d204fb70bc012d82 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 20 Jul 2014 10:14:46 -0600 Subject: save a new tutorial and their tags. --- app/controllers/api/v1/tutorials_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers/api/v1/tutorials_controller.rb') diff --git a/app/controllers/api/v1/tutorials_controller.rb b/app/controllers/api/v1/tutorials_controller.rb index 589012a5..c257f707 100644 --- a/app/controllers/api/v1/tutorials_controller.rb +++ b/app/controllers/api/v1/tutorials_controller.rb @@ -8,7 +8,9 @@ module Api end def create - respond_with(@tutorial = current_user.tutorials.create!(tutorial_params)) + @tutorial = current_user.tutorials.create!(tutorial_params) + current_user.tag(@tutorial, with: params[:tutorial][:tags], on: :tags) + respond_with(@tutorial) end private -- cgit v1.2.3