rubyforgood/babywearing

View on GitHub
app/controllers/photos_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class PhotosController < ApplicationController
  def destroy
    @photo = ActiveStorage::Attachment.find(params[:id])
    carrier = @photo.record
    @photo.purge
    flash[:success] = 'Photo successfully destroyed'
    redirect_to edit_carrier_path(carrier)
  end
end