Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in _image.html.slim
- .box-img
- = check_box_tag "delete_img_ids[#{image.id.to_s}]", image.id, false, class: 'checkbox-input'
- span.check
- = label_tag "delete_img_ids[#{image.id}]", nil, class: 'checkbox-label'
- in controller:
- def destroy_a
- ttach
- attachments = ActiveStorage::Attachment.where(id: params[:delete_img_ids])
- attachments.map(&:purge)
- redirect_back(fallback_location: edit_admin_gallery_path)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement