Class: SpreeCmCommissioner::ProfileImageDestroyer

Inherits:
BaseInteractor show all
Defined in:
app/interactors/spree_cm_commissioner/profile_image_destroyer.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
13
14
# File 'app/interactors/spree_cm_commissioner/profile_image_destroyer.rb', line 5

def call
  profile_image = SpreeCmCommissioner::UserProfile.find_by(viewable: user)

  if profile_image
    profile_image.destroy
    context.result = profile_image
  else
    context.fail!(message: 'No profile image to delete')
  end
end