Class: Fae::ImagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/fae/images_controller.rb

Instance Method Summary collapse

Instance Method Details

#delete_imageObject

ajax delete action

post ‘images/:id/delete_image’ => ‘images#delete_image’, as: :delete_image here we just remove the asset from the attached image model, because if we deleted the model itself, re-uploading a new one would break.



9
10
11
12
13
14
15
# File 'app/controllers/fae/images_controller.rb', line 9

def delete_image
  image = Image.find_by_id(params[:id])
  image.remove_asset = true
  image.save
  CarrierWave.clean_cached_files!
  render :nothing => true
end