Advertisement
Guest User

Untitled

a guest
Nov 18th, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.48 KB | None | 0 0
  1. in _image.html.slim
  2.  
  3.               .box-img
  4.                 = check_box_tag "delete_img_ids[#{image.id.to_s}]", image.id, false, class: 'checkbox-input'
  5.                 span.check
  6.                 = label_tag "delete_img_ids[#{image.id}]", nil, class: 'checkbox-label'
  7.  
  8.  
  9. in controller:
  10.   def destroy_a
  11. ttach
  12.     attachments = ActiveStorage::Attachment.where(id: params[:delete_img_ids])
  13.     attachments.map(&:purge)
  14.     redirect_back(fallback_location: edit_admin_gallery_path)
  15.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement