diff options
| author | mo khan <mo@mokhan.ca> | 2014-06-16 22:41:03 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-06-16 22:41:03 -0600 |
| commit | f4019798d29b352c9d8c6f2e42dd210de6a02e11 (patch) | |
| tree | 940c93eeca8eea0bccace42ded2d50b2c01a7155 /app/controllers/api/v1 | |
| parent | e5b8e39f44fec0b6a3ec9cbfecdd7e744cf2db9f (diff) | |
upload new photos using backbone.
Diffstat (limited to 'app/controllers/api/v1')
| -rw-r--r-- | app/controllers/api/v1/photos_controller.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/api/v1/photos_controller.rb b/app/controllers/api/v1/photos_controller.rb index a9e9e639..cf8a847b 100644 --- a/app/controllers/api/v1/photos_controller.rb +++ b/app/controllers/api/v1/photos_controller.rb @@ -2,6 +2,19 @@ module Api module V1 class PhotosController < ApiController respond_to :json + + def create + cake_id = params[:cake_id] + UploadPhoto.new.run(cake_id, photo_params) + @photo = Creation.find(cake_id).photos.last + respond_with(@photo) + end + + private + + def photo_params + params.require(:photo).permit(:image) + end end end end |
