summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-07-20 08:48:35 -0600
committermo khan <mo@mokhan.ca>2014-07-20 08:48:35 -0600
commita4aac3783c9e0bb496de50fc288f4b85b82aab39 (patch)
tree69dfcc73de64d09dd471f1c9281557d63728a831 /app/controllers/api/v1
parent969cae58d4fbc2f74595d06879e53bcd4ce9d120 (diff)
add create action to tutorials controller.
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r--app/controllers/api/v1/tutorials_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/api/v1/tutorials_controller.rb b/app/controllers/api/v1/tutorials_controller.rb
index 8728a857..589012a5 100644
--- a/app/controllers/api/v1/tutorials_controller.rb
+++ b/app/controllers/api/v1/tutorials_controller.rb
@@ -6,6 +6,16 @@ module Api
def index
respond_with(@tutorials = current_user.tutorials)
end
+
+ def create
+ respond_with(@tutorial = current_user.tutorials.create!(tutorial_params))
+ end
+
+ private
+
+ def tutorial_params
+ params.require(:tutorial).permit(:url, :image_url, :heading, :description)
+ end
end
end
end