Sha256: f0b0b2b9d94ac0174e6883a1d77d98f9610abb7ffdfe693fe96bf8146521af1b
Contents?: true
Size: 691 Bytes
Versions: 6
Compression:
Stored size: 691 Bytes
Contents
module Fae class ImagesController < ApplicationController #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. def delete_image image = Image.find_by_id(params[:id]) image.remove_asset = true image.save CarrierWave.clean_cached_files! render :nothing => true end private #allow mass assignment def image_params if params[:image].present? params.require(:image).permit! else nil end end end end
Version data entries
6 entries across 6 versions & 1 rubygems