summaryrefslogtreecommitdiff
path: root/app/controllers/api
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-07-20 10:14:46 -0600
committermo khan <mo@mokhan.ca>2014-07-20 10:14:46 -0600
commitc2e5237da57312fedc06b801d204fb70bc012d82 (patch)
tree0a3938f57662eb13f386d6d2d4431cea3ed8c67a /app/controllers/api
parent8604e242169e1a9e1630fce6de02b7fca8c55856 (diff)
save a new tutorial and their tags.
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/tutorials_controller.rb4
1 files changed, 3 insertions, 1 deletions
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