Class: Blocky::ImagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Blocky::ImagesController
- Defined in:
- app/controllers/blocky/images_controller.rb
Instance Method Summary collapse
Methods included from Auth
#blocky_current_user, #current_ability, #devise_resource_name, #login_redirect_path, #redirect_back_or_default, #store_location, #unauthorized
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/blocky/images_controller.rb', line 6 def create if s3_bucket file = params[:file] time_file = create_filename(file) s3_object = s3_bucket.objects.create(time_file, file.tempfile, { acl: :public_read }) render text: s3_object.public_url.to_s else throw Exception, "S3 not setup" end end |