Class: Uploadbox::ImagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Uploadbox::ImagesController
- Defined in:
- app/controllers/uploadbox/images_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/uploadbox/images_controller.rb', line 5 def create attributes = image_params attributes["imageable_type"].constantize # load class attributes["original_file"] = attributes["remote_file_url"] attributes.delete("upload_name") attributes.delete("remote_file_url") upload = Uploadbox.const_get(upload_class_name).create!(attributes) unless params["processed"].present? if Uploadbox.background_processing Resque.enqueue(ProcessImage, {id: upload.id, upload_class_name: upload_class_name}) else upload.process end end render nothing: true end |
#destroy ⇒ Object
33 34 35 |
# File 'app/controllers/uploadbox/images_controller.rb', line 33 def destroy render json: Image.find(params[:id]).destroy end |
#find ⇒ Object
26 27 28 29 30 31 |
# File 'app/controllers/uploadbox/images_controller.rb', line 26 def find # binding.pry image_params["imageable_type"].constantize # load class @image = Uploadbox.const_get(upload_class_name).find_by(secure_random: image_params[:secure_random]) end |