app/controllers/spina/admin/photos_controller.rb in spina-0.6.29 vs app/controllers/spina/admin/photos_controller.rb in spina-0.7.0

- old
+ new

@@ -1,10 +1,10 @@ module Spina module Admin class PhotosController < AdminController before_filter :set_breadcrumbs - + authorize_resource class: Photo layout "spina/admin/media_library" def index @@ -12,11 +12,17 @@ @photos = Photo.sorted @photo = Photo.new end def create - @photo = Photo.create(photo_params) + @photo = Photo.create!(photo_params) + respond_to do |format| + format.js + format.json do + render json: { file_url: @photo.file_url } + end + end end def destroy @photo = Photo.find(params[:id]) @photo.destroy @@ -69,9 +75,9 @@ end def photo_params params.require(:photo).permit(:file) end - + end end end